From 7c35e2dcf4143645d33c1cb10824e5a5bc7e02a6 Mon Sep 17 00:00:00 2001 From: Bernhard Date: Wed, 3 Dec 2014 19:38:40 +0100 Subject: [PATCH] Fixed unused values --- lib/src/display/stage.dart | 12 ++++---- lib/src/display_ex/time_gauge.dart | 1 - lib/src/drawing/graphics.dart | 4 +-- lib/src/engine/render_texture.dart | 2 +- lib/src/events/event_phase.dart | 4 +-- lib/src/events/key_location.dart | 4 +-- lib/src/toolkit/timeline_tween.dart | 12 +++----- lib/src/ui/multitouch.dart | 47 ++++++++++++++--------------- test/events/events_test.dart | 8 +++-- 9 files changed, 45 insertions(+), 49 deletions(-) diff --git a/lib/src/display/stage.dart b/lib/src/display/stage.dart index 9593e24c..fa613ee9 100644 --- a/lib/src/display/stage.dart +++ b/lib/src/display/stage.dart @@ -4,8 +4,8 @@ part of stagexl.display; class StageScaleMode { - final int _ordinal; - const StageScaleMode._(this._ordinal); + final int index; + const StageScaleMode._(this.index); static const StageScaleMode EXACT_FIT = const StageScaleMode._(0); static const StageScaleMode NO_BORDER = const StageScaleMode._(1); @@ -19,8 +19,8 @@ class StageScaleMode { class StageAlign { - final int _ordinal; - const StageAlign._(this._ordinal); + final int index; + const StageAlign._(this.index); static const StageAlign BOTTOM = const StageAlign._(0); static const StageAlign BOTTOM_LEFT = const StageAlign._(1); @@ -38,8 +38,8 @@ class StageAlign { class StageRenderMode { - final int _ordinal; - const StageRenderMode._(this._ordinal); + final int index; + const StageRenderMode._(this.index); static const StageRenderMode AUTO = const StageRenderMode._(0); static const StageRenderMode STOP = const StageRenderMode._(1); diff --git a/lib/src/display_ex/time_gauge.dart b/lib/src/display_ex/time_gauge.dart index 062519bf..74659244 100644 --- a/lib/src/display_ex/time_gauge.dart +++ b/lib/src/display_ex/time_gauge.dart @@ -13,7 +13,6 @@ class TimeGauge extends Gauge implements Animatable { static const String TIME_SHORT = 'TIME_SHORT'; bool _isStarted = false; - num _currentTime = 0.0; num _totalTime = 0.0; Map _alarms; diff --git a/lib/src/drawing/graphics.dart b/lib/src/drawing/graphics.dart index 101edd44..a27c5f49 100644 --- a/lib/src/drawing/graphics.dart +++ b/lib/src/drawing/graphics.dart @@ -263,13 +263,13 @@ class Graphics { } //---------------------------------------------------------------------------- - +/* void _drawPath(CanvasRenderingContext2D context) { for(int i = 0; i < _commands.length; i++) { _commands[i].drawPath(context); } } - +*/ } diff --git a/lib/src/engine/render_texture.dart b/lib/src/engine/render_texture.dart index 47226c3d..7910ce9d 100644 --- a/lib/src/engine/render_texture.dart +++ b/lib/src/engine/render_texture.dart @@ -12,7 +12,6 @@ class RenderTexture { CanvasImageSource _source; CanvasElement _canvas; - VideoElement _video; RenderTextureQuad _quad; RenderTextureFiltering _filtering = RenderTextureFiltering.LINEAR; @@ -124,6 +123,7 @@ class RenderTexture { int get width => _width; int get height => _height; + bool get transparent => _transparent; int get storeWidth => _storeWidth; int get storeHeight => _storeHeight; diff --git a/lib/src/events/event_phase.dart b/lib/src/events/event_phase.dart index 84d4e810..b5cf8c6b 100644 --- a/lib/src/events/event_phase.dart +++ b/lib/src/events/event_phase.dart @@ -3,8 +3,8 @@ part of stagexl.events; /// Provides constant values for the eventPhase property of the [Event] class. class EventPhase { - final int _ordinal; - const EventPhase._(this._ordinal); + final int index; + const EventPhase._(this.index); static const EventPhase CAPTURING_PHASE = const EventPhase._(0); static const EventPhase AT_TARGET = const EventPhase._(1); diff --git a/lib/src/events/key_location.dart b/lib/src/events/key_location.dart index 0e46d855..2a8d8526 100644 --- a/lib/src/events/key_location.dart +++ b/lib/src/events/key_location.dart @@ -4,8 +4,8 @@ part of stagexl.events; /// [KeyboardEvent.getKeyLocation]. class KeyLocation { - final int _ordinal; - const KeyLocation._(this._ordinal); + final int index; + const KeyLocation._(this.index); /// The event key is not distinguished as the left or right version /// of the key, and did not originate from the numeric keypad (or did not diff --git a/lib/src/toolkit/timeline_tween.dart b/lib/src/toolkit/timeline_tween.dart index 95ff028d..fa558491 100644 --- a/lib/src/toolkit/timeline_tween.dart +++ b/lib/src/toolkit/timeline_tween.dart @@ -30,7 +30,7 @@ part of stagexl.toolkit; // ToDo: possibly add a END actionsMode (only runs actions that == position)? // ToDo: evaluate a way to decouple paused from tick registration. -/// **Note:** This class is not intended to be used directly. It is needed by +/// **Note:** This class is not intended to be used directly. It is needed by /// the 'Toolkit for Dart' to export from Flash Professional to Dart/StageXL. /// /// A TimelineTween instance tweens properties for a single target. @@ -412,7 +412,7 @@ class TimelineTween { return end; } - var prevPos = _prevPos; + //var prevPos = _prevPos; position = _prevPos = t; // set this in advance in case an action modifies position. _prevPosition = value; @@ -491,7 +491,7 @@ class TimelineTween { * @protected **/ void _updateTargetProps(TimelineStep step, num ratio) { - var p0, p1, v, v0, v1, arr; + var p0, p1, v, v0, v1; num dv, dv0, dv1; if (step == null && ratio == 1) { p0 = p1 = _curQueueProps; @@ -612,11 +612,7 @@ class TimelineTween { * @protected **/ Map _appendQueueProps(Map o) { - var arr, - oldValue = null, - i, - l, - injectProps; + var oldValue = null; for (var n in o.keys) { if (!_initQueueProps.containsKey(n)) { diff --git a/lib/src/ui/multitouch.dart b/lib/src/ui/multitouch.dart index 72e6c574..02196a49 100644 --- a/lib/src/ui/multitouch.dart +++ b/lib/src/ui/multitouch.dart @@ -8,26 +8,26 @@ class MultitouchInputMode { final String name; const MultitouchInputMode(this.name); - /// Specifies that gesture events are dispatched for the related user - /// interaction supported by the current environment, and other touch events + /// Specifies that gesture events are dispatched for the related user + /// interaction supported by the current environment, and other touch events /// (such as a simple tap) are interpreted as mouse events. static const MultitouchInputMode GESTURE = const MultitouchInputMode("GESTURE"); - + /// Specifies that all user contact with a touch-enabled device is interpreted /// as a type of mouse event. static const MultitouchInputMode NONE = const MultitouchInputMode("NONE"); - - /// Specifies that events are dispatched only for basic touch events, such as - /// a single finger tap. When you use this setting, events listed in the + + /// Specifies that events are dispatched only for basic touch events, such as + /// a single finger tap. When you use this setting, events listed in the /// [TouchEvent] class are dispatched; events listed in the gesture event /// classes are not dispatched. static const MultitouchInputMode TOUCH_POINT = const MultitouchInputMode("TOUCH_POINT"); } /// The [Multitouch] class is used opt-in for multi touch support in your -/// application. -/// -/// It also provides an easy way to check if the current device supports multi +/// application. +/// +/// It also provides an easy way to check if the current device supports multi /// touch or not. /// /// Example: @@ -41,26 +41,25 @@ class MultitouchInputMode { /// sprite.onTouchBegin.listen(_onTouchBegin); class Multitouch { - /// Indicates whether the current environment supports gesture input, such as - /// rotating two fingers around a touch screen. - /// + /// Indicates whether the current environment supports gesture input, such as + /// rotating two fingers around a touch screen. + /// /// Note: This always returns false because gestures are not implementet yet. /// TODO: Implement gesture support. static bool supportsGestureEvents = false; - - /// Indicates whether the current environment supports basic touch input. + + /// Indicates whether the current environment supports basic touch input. /// Touch events are listed in the [TouchEvent] class. static bool supportsTouchEvents = _checkTouchEvents(); - - /// A list of multi-touch contact types supported in the current environment. - /// The list of Strings can be used as event types to register event - /// listeners. - /// + + /// A list of multi-touch contact types supported in the current environment. + /// The list of Strings can be used as event types to register event + /// listeners. + /// /// Note: The list is currently empty because gestures are not implemented yet. /// TODO: Implement gesture support. static List supportedGestures = []; - static bool _initialized = false; static MultitouchInputMode _inputMode = MultitouchInputMode.NONE; static final _inputModeChangedEvent = new StreamController.broadcast(); @@ -70,12 +69,12 @@ class Multitouch { static int get maxTouchPoints => supportsTouchEvents ? 10 : 0; - /// Returns the multi-touch mode for touch and gesture event handling. + /// Returns the multi-touch mode for touch and gesture event handling. static MultitouchInputMode get inputMode => _inputMode; - /// Sets the multi-touch mode for touch and gesture event handling. Use - /// this property to manage whether or not events are dispatched as touch - /// events with multiple points of contact and specific events for different + /// Sets the multi-touch mode for touch and gesture event handling. Use + /// this property to manage whether or not events are dispatched as touch + /// events with multiple points of contact and specific events for different /// gestures. static set inputMode(MultitouchInputMode value) { _inputMode = value; diff --git a/test/events/events_test.dart b/test/events/events_test.dart index f1e25a77..3316dfc4 100644 --- a/test/events/events_test.dart +++ b/test/events/events_test.dart @@ -89,12 +89,14 @@ void main() { var sub1 = dispatcher.on(eventType).listen(listener1); var sub2 = dispatcher.on(eventType).listen(listener2); - var sub3 = dispatcher.on(eventType).listen((Event event) => actual.add( - "listener3")); + var sub3 = dispatcher.on(eventType).listen((Event event) => actual.add("listener3")); sub2.cancel(); - dispatcher.dispatchEvent(new Event(eventType)); + + expect(sub1.isCanceled, equals(false)); + expect(sub2.isCanceled, equals(true)); + expect(sub3.isCanceled, equals(false)); expect(actual, equals(expected)); });