Skip to content

Commit

Permalink
Merge pull request #61 from goderbauer/addMouseToClick
Browse files Browse the repository at this point in the history
add mouse down/up events to click in html.dart
  • Loading branch information
DrMarcII committed Jan 6, 2016
2 parents 5f9e6b5 + 5c9bd42 commit 7fcbb1b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions dart/lib/async/html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,22 @@ class _ElementPageLoaderElement extends HtmlPageLoaderElement {
Future<Rectangle> get offset async => node.offset;

@override
Future click({bool sync: true}) => loader.executeSynced(() {
Future click({bool sync: true}) => loader.executeSynced(() async {
if (node is OptionElement) {
return _clickOptionElement();
} else if (node is SvgElement) {
}

await _microtask(() =>
node.dispatchEvent(new Event.eventType('MouseEvent', 'mousedown')));
await _microtask(() =>
node.dispatchEvent(new Event.eventType('MouseEvent', 'mouseup')));

if (node is SvgElement) {
return _microtask(() =>
node.dispatchEvent(new Event.eventType('MouseEvent', 'click')));
} else {
return _microtask(node.click);
}
}

return _microtask(node.click);
}, sync);

Future _clickOptionElement() {
Expand Down

0 comments on commit 7fcbb1b

Please sign in to comment.