Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: samples/openglui/src/openglui_canvas_tests.dart

Issue 12390045: Added a rudimentary DOM, to assist with event dispatch. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samples/openglui/src/openglui_canvas_tests.dart
===================================================================
--- samples/openglui/src/openglui_canvas_tests.dart (revision 19252)
+++ samples/openglui/src/openglui_canvas_tests.dart (working copy)
@@ -25,15 +25,19 @@
if (canvasp == null) {
log("Allocating canvas");
canvas = new CanvasElement(width: w, height: h);
+ document.body.nodes.add(canvas);
} else {
log("Using parent canvas");
canvas = canvasp;
- // called from gl_driver.dart.
- // This is a kludge; we need a clean way of handling events.
- canvas.on.mouseDown.add((e) {
- ++testnum;
- });
}
+ canvas.onMouseDown.listen((e) {
+ ++testnum;
+ isDirty = true;
+ });
+ canvas.onKeyDown.listen((e) {
+ ++testnum;
+ isDirty = true;
+ });
ctx = canvas.getContext("2d");
if (ctx == null) {
throw "Failed to get 2D context";
@@ -736,39 +740,3 @@
isDirty = false;
}
-/*
-TODO(gram): below are the current entry points for input events for the
-native code version. We need to integrate these somehow with the WebGL
-version:
-*/
-onMotionDown(num when, num x, num y) {
- ++testnum;
- isDirty = true;
- log("Marking dirty");
-}
-onMotionUp(num when, num x, num y) {}
-onMotionMove(num when, num x, num y) {}
-onMotionCancel(num when, num x, num y) {}
-onMotionOutside(num when, num x, num y) {}
-onMotionPointerDown(num when, num x, num y) {
- ++testnum;
- isDirty = true;
- log("Marking dirty");
-}
-
-onMotionPointerUp(num when, num x, num y) {}
-
-onKeyDown(num when, int flags, int keycode, int metastate, int repeat) {
- if (keycode == 32) {
- ++testnum;
- isDirty = true;
- log("Marking dirty");
- }
-}
-
-onKeyUp(num when, int flags, int keycode, int metastate, int repeat) {}
-
-onKeyMultiple(num when, int flags, int keycode, int metastate, int repeat) {
-}
-
-

Powered by Google App Engine
This is Rietveld 408576698