Handling Tracking Events in Polymer.dart

I am trying to create a custom Polymer element. I have long built polymer elements. This is the first time I need to use complex mouse events and gestures.

After dealing with mouse events, I found that Polymer provides us with touch and gesture events that are very useful in this work.

However, I cannot get it to work in Dart.

fx_slider.html:

<div id="main-div">
  <div id="slider-track"></div>
  <div id="slider-thumb" on-trackstart="{{trackStartHandler}}"
    on-trackend="{{trackEndHandler}}" on-track="{{trackHandler}}">
  </div>
</div>

fx_slider.dart:

void trackStartHandler (Event e) {
  dragging = true;
}

void trackEndHandler (Event e) {
  dragging =  false;
}

void trackHandler (Event e, var detail, Node target) {
  /* How to retrieve the mouse position or the dx property from event ??? */
}

My event handler (trackHandler) receives an Event instead of TrackEvent or MouseEvent , so I can’t get the movement the user made or the cursor position.

Can any of you tell me how to use tracking events in Dart?

Thanks in advance!

+4
1

, Dart.

(. http://dartbug.com/21138 - , : -/)

void trackHandler (Event e, var detail, Node target) {
  var touchEvent = new js.JsObject.fromBrowserObject(e);
  print('x: ${touchEvent['dx']}, y: ${touchEvent['dy']}');
}

[[JavaScript View]] node.

+5

All Articles