| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Wraps a callback with translations of mouse events to touch events. Use | 6 * Wraps a callback with translations of mouse events to touch events. Use |
| 7 * this function to invoke your callback that expects touch events after | 7 * this function to invoke your callback that expects touch events after |
| 8 * touch events are created from the actual mouse events. | 8 * touch events are created from the actual mouse events. |
| 9 */ | 9 */ |
| 10 EventListener mouseToTouchCallback(EventListener callback) { | 10 EventListener mouseToTouchCallback(EventListener callback) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 */ | 134 */ |
| 135 void onDragMove(); | 135 void onDragMove(); |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * The object has started dragging. | 138 * The object has started dragging. |
| 139 * Returns true to allow a drag sequence to begin (custom behavior), | 139 * Returns true to allow a drag sequence to begin (custom behavior), |
| 140 * false to disable dragging for this touch duration (allow native scrolling). | 140 * false to disable dragging for this touch duration (allow native scrolling). |
| 141 */ | 141 */ |
| 142 bool onDragStart(TouchEvent e); | 142 bool onDragStart(TouchEvent e); |
| 143 | 143 |
| 144 bool get verticalEnabled(); | 144 bool get verticalEnabled; |
| 145 bool get horizontalEnabled(); | 145 bool get horizontalEnabled; |
| 146 } | 146 } |
| 147 | 147 |
| 148 class MockTouch implements Touch { | 148 class MockTouch implements Touch { |
| 149 MouseEvent wrapped; | 149 MouseEvent wrapped; |
| 150 | 150 |
| 151 MockTouch(MouseEvent this.wrapped) {} | 151 MockTouch(MouseEvent this.wrapped) {} |
| 152 | 152 |
| 153 int get clientX() => wrapped.clientX; | 153 int get clientX => wrapped.clientX; |
| 154 | 154 |
| 155 int get clientY() => wrapped.clientY; | 155 int get clientY => wrapped.clientY; |
| 156 | 156 |
| 157 int get identifier() => 0; | 157 int get identifier => 0; |
| 158 | 158 |
| 159 int get pageX() => wrapped.pageX; | 159 int get pageX => wrapped.pageX; |
| 160 | 160 |
| 161 int get pageY() => wrapped.pageY; | 161 int get pageY => wrapped.pageY; |
| 162 | 162 |
| 163 int get screenX() => wrapped.screenX; | 163 int get screenX => wrapped.screenX; |
| 164 | 164 |
| 165 int get screenY() {return wrapped.screenY; } | 165 int get screenY {return wrapped.screenY; } |
| 166 | 166 |
| 167 EventTarget get target() => wrapped.target; | 167 EventTarget get target => wrapped.target; |
| 168 | 168 |
| 169 num get webkitForce() { throw new NotImplementedException(); } | 169 num get webkitForce { throw new NotImplementedException(); } |
| 170 int get webkitRadiusX() { throw new NotImplementedException(); } | 170 int get webkitRadiusX { throw new NotImplementedException(); } |
| 171 int get webkitRadiusY() { throw new NotImplementedException(); } | 171 int get webkitRadiusY { throw new NotImplementedException(); } |
| 172 num get webkitRotationAngle() { throw new NotImplementedException(); } | 172 num get webkitRotationAngle { throw new NotImplementedException(); } |
| 173 } | 173 } |
| 174 | 174 |
| 175 class MockTouchEvent implements TouchEvent { | 175 class MockTouchEvent implements TouchEvent { |
| 176 MouseEvent wrapped; | 176 MouseEvent wrapped; |
| 177 // TODO(jacobr): these are currently Lists instead of a TouchList. | 177 // TODO(jacobr): these are currently Lists instead of a TouchList. |
| 178 final List<Touch> touches; | 178 final List<Touch> touches; |
| 179 final List<Touch> targetTouches; | 179 final List<Touch> targetTouches; |
| 180 final List<Touch> changedTouches; | 180 final List<Touch> changedTouches; |
| 181 MockTouchEvent(MouseEvent this.wrapped, List<Touch> this.touches, | 181 MockTouchEvent(MouseEvent this.wrapped, List<Touch> this.touches, |
| 182 List<Touch> this.targetTouches, | 182 List<Touch> this.targetTouches, |
| 183 List<Touch> this.changedTouches) {} | 183 List<Touch> this.changedTouches) {} |
| 184 | 184 |
| 185 bool get bubbles() => wrapped.bubbles; | 185 bool get bubbles => wrapped.bubbles; |
| 186 | 186 |
| 187 bool get cancelBubble() => wrapped.cancelBubble; | 187 bool get cancelBubble => wrapped.cancelBubble; |
| 188 | 188 |
| 189 void set cancelBubble(bool value) { wrapped.cancelBubble = value; } | 189 void set cancelBubble(bool value) { wrapped.cancelBubble = value; } |
| 190 | 190 |
| 191 bool get cancelable() => wrapped.cancelable; | 191 bool get cancelable => wrapped.cancelable; |
| 192 | 192 |
| 193 EventTarget get currentTarget() => wrapped.currentTarget; | 193 EventTarget get currentTarget => wrapped.currentTarget; |
| 194 | 194 |
| 195 bool get defaultPrevented() => wrapped.defaultPrevented; | 195 bool get defaultPrevented => wrapped.defaultPrevented; |
| 196 | 196 |
| 197 int get eventPhase() => wrapped.eventPhase; | 197 int get eventPhase => wrapped.eventPhase; |
| 198 | 198 |
| 199 void set returnValue(bool value) { wrapped.returnValue = value; } | 199 void set returnValue(bool value) { wrapped.returnValue = value; } |
| 200 | 200 |
| 201 bool get returnValue() => wrapped.returnValue; | 201 bool get returnValue => wrapped.returnValue; |
| 202 | 202 |
| 203 EventTarget get srcElement() => wrapped.srcElement; | 203 EventTarget get srcElement => wrapped.srcElement; |
| 204 | 204 |
| 205 EventTarget get target() => wrapped.target; | 205 EventTarget get target => wrapped.target; |
| 206 | 206 |
| 207 int get timeStamp() => wrapped.timeStamp; | 207 int get timeStamp => wrapped.timeStamp; |
| 208 | 208 |
| 209 String get type() => wrapped.type; | 209 String get type => wrapped.type; |
| 210 | 210 |
| 211 void preventDefault() { wrapped.preventDefault(); } | 211 void preventDefault() { wrapped.preventDefault(); } |
| 212 | 212 |
| 213 void stopImmediatePropagation() { wrapped.stopImmediatePropagation(); } | 213 void stopImmediatePropagation() { wrapped.stopImmediatePropagation(); } |
| 214 | 214 |
| 215 void stopPropagation() { wrapped.stopPropagation(); } | 215 void stopPropagation() { wrapped.stopPropagation(); } |
| 216 | 216 |
| 217 int get charCode() => wrapped.charCode; | 217 int get charCode => wrapped.charCode; |
| 218 | 218 |
| 219 int get detail() => wrapped.detail; | 219 int get detail => wrapped.detail; |
| 220 | 220 |
| 221 int get keyCode() => wrapped.keyCode; | 221 int get keyCode => wrapped.keyCode; |
| 222 | 222 |
| 223 int get layerX() => wrapped.layerX; | 223 int get layerX => wrapped.layerX; |
| 224 | 224 |
| 225 int get layerY() => wrapped.layerY; | 225 int get layerY => wrapped.layerY; |
| 226 | 226 |
| 227 int get pageX() => wrapped.pageX; | 227 int get pageX => wrapped.pageX; |
| 228 | 228 |
| 229 int get pageY() => wrapped.pageY; | 229 int get pageY => wrapped.pageY; |
| 230 | 230 |
| 231 Window get view() => wrapped.view; | 231 Window get view => wrapped.view; |
| 232 | 232 |
| 233 int get which() => wrapped.which; | 233 int get which => wrapped.which; |
| 234 | 234 |
| 235 bool get altKey() => wrapped.altKey; | 235 bool get altKey => wrapped.altKey; |
| 236 | 236 |
| 237 bool get ctrlKey() => wrapped.ctrlKey; | 237 bool get ctrlKey => wrapped.ctrlKey; |
| 238 | 238 |
| 239 bool get metaKey() => wrapped.metaKey; | 239 bool get metaKey => wrapped.metaKey; |
| 240 | 240 |
| 241 bool get shiftKey() => wrapped.shiftKey; | 241 bool get shiftKey => wrapped.shiftKey; |
| 242 } | 242 } |
| OLD | NEW |