rasputin 0.10.7 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -21
- data/lib/rasputin/handlebars/compiler.rb +1 -1
- data/lib/rasputin/handlebars/handlebars.js +20 -20
- data/lib/rasputin/handlebars/template.rb +2 -2
- data/lib/rasputin/version.rb +1 -1
- data/rasputin.gemspec +2 -2
- data/vendor/assets/javascripts/{sproutcore-datastore.js → ember-datastore.js} +925 -925
- data/vendor/assets/javascripts/{sproutcore-datetime.js → ember-datetime.js} +99 -99
- data/vendor/assets/javascripts/ember-i18n.js +21 -0
- data/vendor/assets/javascripts/{sproutcore-routing.js → ember-routing.js} +26 -26
- data/vendor/assets/javascripts/{sproutcore-touch.js → ember-touch.js} +91 -93
- data/vendor/assets/javascripts/{sproutcore.js → ember.js} +1369 -1355
- metadata +18 -20
- data/vendor/assets/javascripts/sproutcore-i18n.js +0 -21
- data/vendor/assets/javascripts/sproutcore-statechart.js +0 -3265
- data/vendor/assets/javascripts/sproutcore-utils.js +0 -73
@@ -0,0 +1,21 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
Ember.I18n = I18n;
|
4
|
+
|
5
|
+
Ember.String.loc = function(scope, options) {
|
6
|
+
return Ember.I18n.translate(scope, options);
|
7
|
+
};
|
8
|
+
|
9
|
+
Ember.STRINGS = Ember.I18n.translations;
|
10
|
+
|
11
|
+
Ember.Handlebars.registerHelper('loc', function(property) {
|
12
|
+
return Ember.String.loc(property);
|
13
|
+
});
|
14
|
+
|
15
|
+
if (Ember.EXTEND_PROTOTYPES) {
|
16
|
+
String.prototype.loc = function(options) {
|
17
|
+
return Ember.String.loc(String(this), options);
|
18
|
+
};
|
19
|
+
}
|
20
|
+
|
21
|
+
})();
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// ==========================================================================
|
2
|
-
// Project:
|
2
|
+
// Project: Ember - JavaScript Application Framework
|
3
3
|
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
4
4
|
// Portions ©2008-2011 Apple Inc. All rights reserved.
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
(function() {
|
9
9
|
|
10
|
-
var get =
|
10
|
+
var get = Ember.get, set = Ember.set;
|
11
11
|
|
12
12
|
/**
|
13
13
|
Wether the browser supports HTML5 history.
|
@@ -22,11 +22,11 @@ var supportsHashChange = ('onhashchange' in window) && (document.documentMode ==
|
|
22
22
|
/**
|
23
23
|
@class
|
24
24
|
|
25
|
-
Route is a class used internally by
|
25
|
+
Route is a class used internally by Ember.routes. The routes defined by your
|
26
26
|
application are stored in a tree structure, and this is the class for the
|
27
27
|
nodes.
|
28
28
|
*/
|
29
|
-
var Route =
|
29
|
+
var Route = Ember.Object.extend(
|
30
30
|
/** @scope Route.prototype */ {
|
31
31
|
|
32
32
|
target: null,
|
@@ -43,7 +43,7 @@ var Route = SC.Object.extend(
|
|
43
43
|
var part, nextRoute;
|
44
44
|
|
45
45
|
// clone the parts array because we are going to alter it
|
46
|
-
parts =
|
46
|
+
parts = Ember.copy(parts);
|
47
47
|
|
48
48
|
if (!parts || parts.length === 0) {
|
49
49
|
this.target = target;
|
@@ -86,7 +86,7 @@ var Route = SC.Object.extend(
|
|
86
86
|
var part, key, route;
|
87
87
|
|
88
88
|
// clone the parts array because we are going to alter it
|
89
|
-
parts =
|
89
|
+
parts = Ember.copy(parts);
|
90
90
|
|
91
91
|
// if parts is empty, we are done
|
92
92
|
if (!parts || parts.length === 0) {
|
@@ -128,37 +128,37 @@ var Route = SC.Object.extend(
|
|
128
128
|
/**
|
129
129
|
@class
|
130
130
|
|
131
|
-
|
131
|
+
Ember.routes manages the browser location. You can change the hash part of the
|
132
132
|
current location. The following code
|
133
133
|
|
134
|
-
|
134
|
+
Ember.routes.set('location', 'notes/edit/4');
|
135
135
|
|
136
136
|
will change the location to http://domain.tld/my_app#notes/edit/4. Adding
|
137
137
|
routes will register a handler that will be called whenever the location
|
138
138
|
changes and matches the route:
|
139
139
|
|
140
|
-
|
140
|
+
Ember.routes.add(':controller/:action/:id', MyApp, MyApp.route);
|
141
141
|
|
142
142
|
You can pass additional parameters in the location hash that will be relayed
|
143
143
|
to the route handler:
|
144
144
|
|
145
|
-
|
145
|
+
Ember.routes.set('location', 'notes/show/4?format=xml&language=fr');
|
146
146
|
|
147
147
|
The syntax for the location hash is described in the location property
|
148
148
|
documentation, and the syntax for adding handlers is described in the
|
149
149
|
add method documentation.
|
150
150
|
|
151
151
|
Browsers keep track of the locations in their history, so when the user
|
152
|
-
presses the 'back' or 'forward' button, the location is changed,
|
152
|
+
presses the 'back' or 'forward' button, the location is changed, Ember.route
|
153
153
|
catches it and calls your handler. Except for Internet Explorer versions 7
|
154
154
|
and earlier, which do not modify the history stack when the location hash
|
155
155
|
changes.
|
156
156
|
|
157
|
-
|
157
|
+
Ember.routes also supports HTML5 history, which uses a '/' instead of a '#'
|
158
158
|
in the URLs, so that all your website's URLs are consistent.
|
159
159
|
*/
|
160
|
-
var routes =
|
161
|
-
/** @scope
|
160
|
+
var routes = Ember.routes = Ember.Object.create(
|
161
|
+
/** @scope Ember.routes.prototype */{
|
162
162
|
|
163
163
|
/**
|
164
164
|
Set this property to true if you want to use HTML5 history, if available on
|
@@ -221,7 +221,7 @@ var routes = SC.routes = SC.Object.create(
|
|
221
221
|
|
222
222
|
/** @private
|
223
223
|
A boolean value indicating whether or not the ping method has been called
|
224
|
-
to setup the
|
224
|
+
to setup the Ember.routes.
|
225
225
|
|
226
226
|
@property
|
227
227
|
@type {Boolean}
|
@@ -303,7 +303,7 @@ var routes = SC.routes = SC.Object.create(
|
|
303
303
|
|
304
304
|
The following code
|
305
305
|
|
306
|
-
|
306
|
+
Ember.routes.set('location', 'notes/edit/4');
|
307
307
|
|
308
308
|
will change the location to http://domain.tld/my_app#notes/edit/4 and call
|
309
309
|
the correct route handler if it has been registered with the add method.
|
@@ -311,8 +311,8 @@ var routes = SC.routes = SC.Object.create(
|
|
311
311
|
You can also pass additional parameters. They will be relayed to the route
|
312
312
|
handler. For example, the following code
|
313
313
|
|
314
|
-
|
315
|
-
|
314
|
+
Ember.routes.add(':controller/:action/:id', MyApp, MyApp.route);
|
315
|
+
Ember.routes.set('location', 'notes/show/4?format=xml&language=fr');
|
316
316
|
|
317
317
|
will change the location to
|
318
318
|
http://domain.tld/my_app#notes/show/4?format=xml&language=fr and call the
|
@@ -328,7 +328,7 @@ var routes = SC.routes = SC.Object.create(
|
|
328
328
|
|
329
329
|
The location can also be set with a hash, the following code
|
330
330
|
|
331
|
-
|
331
|
+
Ember.routes.set('location',
|
332
332
|
{ route: 'notes/edit/4', format: 'xml', language: 'fr' });
|
333
333
|
|
334
334
|
will change the location to
|
@@ -358,7 +358,7 @@ var routes = SC.routes = SC.Object.create(
|
|
358
358
|
value = crumbs.route + crumbs.params;
|
359
359
|
}
|
360
360
|
|
361
|
-
if (!
|
361
|
+
if (!Ember.empty(value) || (this._location && this._location !== value)) {
|
362
362
|
encodedValue = encodeURI(value);
|
363
363
|
|
364
364
|
if (this.usesHistory) {
|
@@ -404,7 +404,7 @@ var routes = SC.routes = SC.Object.create(
|
|
404
404
|
jQuery(window).bind('hashchange', hashChange);
|
405
405
|
|
406
406
|
} else {
|
407
|
-
// we don't use a
|
407
|
+
// we don't use a Ember.Timer because we don't want
|
408
408
|
// a run loop to be triggered at each ping
|
409
409
|
that = this;
|
410
410
|
this._invokeHashChange = function() {
|
@@ -441,13 +441,13 @@ var routes = SC.routes = SC.Object.create(
|
|
441
441
|
*/
|
442
442
|
add: function(route, target, method) {
|
443
443
|
if (!this._didSetup) {
|
444
|
-
|
444
|
+
Ember.run.once(this, 'ping');
|
445
445
|
}
|
446
446
|
|
447
|
-
if (method === undefined &&
|
447
|
+
if (method === undefined && Ember.typeOf(target) === 'function') {
|
448
448
|
method = target;
|
449
449
|
target = null;
|
450
|
-
} else if (
|
450
|
+
} else if (Ember.typeOf(method) === 'string') {
|
451
451
|
method = target[method];
|
452
452
|
}
|
453
453
|
|
@@ -521,7 +521,7 @@ function hashChange(event) {
|
|
521
521
|
}
|
522
522
|
|
523
523
|
if (get(routes, 'location') !== loc && !routes._skipRoute) {
|
524
|
-
|
524
|
+
Ember.run.once(function() {
|
525
525
|
set(routes, 'location', loc);
|
526
526
|
});
|
527
527
|
}
|
@@ -538,7 +538,7 @@ function popState(event) {
|
|
538
538
|
loc = loc.slice(base.length + 1, loc.length);
|
539
539
|
|
540
540
|
if (get(routes, 'location') !== loc && !routes._skipRoute) {
|
541
|
-
|
541
|
+
Ember.run.once(function() {
|
542
542
|
set(routes, 'location', loc);
|
543
543
|
});
|
544
544
|
}
|
@@ -1,30 +1,28 @@
|
|
1
|
-
//=require TransformJS
|
2
|
-
|
3
1
|
(function(exports) {
|
4
2
|
// ==========================================================================
|
5
|
-
// Project:
|
3
|
+
// Project: Ember Runtime
|
6
4
|
// Copyright: ©2011 Strobe Inc. and contributors.
|
7
5
|
// License: Licensed under MIT license (see license.js)
|
8
6
|
// ==========================================================================
|
9
7
|
|
10
|
-
var get =
|
11
|
-
var set =
|
8
|
+
var get = Ember.get;
|
9
|
+
var set = Ember.set;
|
12
10
|
|
13
11
|
/**
|
14
12
|
@class
|
15
13
|
|
16
14
|
Registry of known gestures in the system. This is a singleton class, and is
|
17
|
-
used by
|
15
|
+
used by Ember.View to analyze instances of Ember.View for gesture support.
|
18
16
|
|
19
17
|
You will not use this class yourself. Rather, gesture recognizers will call
|
20
|
-
|
18
|
+
Ember.Gestures.register(name, recognizer) when they want to make the system aware
|
21
19
|
of them.
|
22
20
|
|
23
21
|
@private
|
24
|
-
@extends
|
22
|
+
@extends Ember.Object
|
25
23
|
*/
|
26
|
-
|
27
|
-
/** @scope
|
24
|
+
Ember.Gestures = Ember.Object.create(
|
25
|
+
/** @scope Ember.Gestures.prototype */{
|
28
26
|
|
29
27
|
_registeredGestures: null,
|
30
28
|
|
@@ -38,11 +36,11 @@ SC.Gestures = SC.Object.create(
|
|
38
36
|
Registers a gesture recognizer to the system. The gesture recognizer is
|
39
37
|
identified by the name parameter, which must be globally unique.
|
40
38
|
*/
|
41
|
-
register: function(name,
|
39
|
+
register: function(name, recognizer) {
|
42
40
|
var registeredGestures = this._registeredGestures;
|
43
41
|
|
44
42
|
if (registeredGestures[name] !== undefined) {
|
45
|
-
throw new
|
43
|
+
throw new Ember.Error(name+" already exists as a registered gesture recognizers. Gesture recognizers must have globally unique names.");
|
46
44
|
}
|
47
45
|
|
48
46
|
registeredGestures[name] = recognizer;
|
@@ -79,28 +77,28 @@ SC.Gestures = SC.Object.create(
|
|
79
77
|
// License: Licensed under MIT license (see license.js)
|
80
78
|
// ==========================================================================
|
81
79
|
|
82
|
-
var get =
|
83
|
-
var set =
|
80
|
+
var get = Ember.get;
|
81
|
+
var set = Ember.set;
|
84
82
|
|
85
83
|
/**
|
86
84
|
@class
|
87
85
|
|
88
86
|
Manages multiplegesture recognizers that are associated with a view.
|
89
|
-
This class is instantiated automatically by
|
87
|
+
This class is instantiated automatically by Ember.View and you wouldn't
|
90
88
|
interact with it yourself.
|
91
89
|
|
92
|
-
|
90
|
+
Ember.GestureManager mainly acts as a composite for the multiple gesture
|
93
91
|
recognizers associated with a view. Whenever it gets a touch event, it
|
94
92
|
relays it to the gestures. The other main resposibility of
|
95
|
-
|
93
|
+
Ember.GestureManager is to handle re-dispatching of events to the view.
|
96
94
|
|
97
|
-
@extends
|
95
|
+
@extends Ember.Object
|
98
96
|
*/
|
99
|
-
|
97
|
+
Ember.GestureManager = Ember.Object.extend({
|
100
98
|
|
101
99
|
/**
|
102
100
|
An array containing all the gesture recognizers associated with a
|
103
|
-
view. This is set automatically by
|
101
|
+
view. This is set automatically by Ember.View.
|
104
102
|
|
105
103
|
@default null
|
106
104
|
@type Array
|
@@ -120,7 +118,7 @@ SC.GestureManager = SC.Object.extend({
|
|
120
118
|
_redispatchToNearestParentViewWaitingForTouches: function(evt, view) {
|
121
119
|
var foundManager = null,
|
122
120
|
successful = false;
|
123
|
-
|
121
|
+
view = get(view, 'parentView');
|
124
122
|
|
125
123
|
while(view) {
|
126
124
|
var manager = get(view, 'eventManager');
|
@@ -129,7 +127,7 @@ SC.GestureManager = SC.Object.extend({
|
|
129
127
|
var gestures = get(manager, 'gestures');
|
130
128
|
|
131
129
|
for (var i=0, l=gestures.length; i<l; i++) {
|
132
|
-
if (get(gestures[i], 'state') ===
|
130
|
+
if (get(gestures[i], 'state') === Ember.Gesture.WAITING_FOR_TOUCHES) {
|
133
131
|
foundManager = manager;
|
134
132
|
}
|
135
133
|
}
|
@@ -208,10 +206,10 @@ SC.GestureManager = SC.Object.extend({
|
|
208
206
|
gesture = gestures[i];
|
209
207
|
handler = gesture[eventName];
|
210
208
|
|
211
|
-
if (
|
209
|
+
if (Ember.typeOf(handler) === 'function') {
|
212
210
|
result = handler.call(gesture, eventObject, view, this);
|
213
211
|
}
|
214
|
-
}
|
212
|
+
}
|
215
213
|
|
216
214
|
this._flushReDispatchQueue();
|
217
215
|
|
@@ -283,8 +281,8 @@ SC.GestureManager = SC.Object.extend({
|
|
283
281
|
// License: Licensed under MIT license (see license.js)
|
284
282
|
// ==========================================================================
|
285
283
|
|
286
|
-
var get =
|
287
|
-
var set =
|
284
|
+
var get = Ember.get;
|
285
|
+
var set = Ember.set;
|
288
286
|
|
289
287
|
/**
|
290
288
|
@class
|
@@ -293,7 +291,7 @@ var set = SC.set;
|
|
293
291
|
Used to manage and maintain a list of active touches related to a gesture
|
294
292
|
recognizer.
|
295
293
|
*/
|
296
|
-
|
294
|
+
Ember.TouchList = Ember.Object.extend({
|
297
295
|
touches: null,
|
298
296
|
|
299
297
|
timestamp: null,
|
@@ -376,8 +374,8 @@ SC.TouchList = SC.Object.extend({
|
|
376
374
|
|
377
375
|
|
378
376
|
|
379
|
-
var get =
|
380
|
-
var set =
|
377
|
+
var get = Ember.get;
|
378
|
+
var set = Ember.set;
|
381
379
|
|
382
380
|
var sigFigs = 100;
|
383
381
|
|
@@ -416,11 +414,11 @@ var sigFigs = 100;
|
|
416
414
|
|
417
415
|
## Usage
|
418
416
|
|
419
|
-
While you wouldn't use
|
417
|
+
While you wouldn't use Ember.Gesture directly, all its subclasses implement the
|
420
418
|
same API. For example, to implement pinch on a view, you implement one or more
|
421
419
|
of the pinch events. For example:
|
422
420
|
|
423
|
-
var myView =
|
421
|
+
var myView = Ember.View.create({
|
424
422
|
pinchStart: function(recognizer) {
|
425
423
|
this.$().css('background','red');
|
426
424
|
},
|
@@ -453,7 +451,7 @@ var sigFigs = 100;
|
|
453
451
|
two-finger gesture. In that case, you can override defaults by specifying an
|
454
452
|
Options hash.
|
455
453
|
|
456
|
-
var myView =
|
454
|
+
var myView = Ember.View.create({
|
457
455
|
panOptions: {
|
458
456
|
numberOfRequiredTouches: 2
|
459
457
|
}
|
@@ -461,7 +459,7 @@ var sigFigs = 100;
|
|
461
459
|
|
462
460
|
## Creating Custom Gesture Recognizers
|
463
461
|
|
464
|
-
|
462
|
+
Ember.Gesture also defines an API which its subclasses can implement to build
|
465
463
|
custom gestures. The methods are:
|
466
464
|
|
467
465
|
* **didBecomePossible** - Called when a gesture enters a possible state. This
|
@@ -504,16 +502,16 @@ var sigFigs = 100;
|
|
504
502
|
gestures. Discrete gestures do not get Start, Change nor Cancel events sent,
|
505
503
|
since they represent a single, instantaneous event, rather than a continuous
|
506
504
|
motion. If you are implementing your own discrete gesture recognizer, you must
|
507
|
-
set the isDiscreteGesture property to yes, and
|
505
|
+
set the isDiscreteGesture property to yes, and Ember.Gesture will adapt its behavior.
|
508
506
|
|
509
507
|
Discrete gestures use the shouldEnd callback to either accept or decline the gesture
|
510
508
|
event. If it is declined, then the gesture will enter a Cancelled state.
|
511
509
|
|
512
|
-
@extends
|
510
|
+
@extends Ember.Object
|
513
511
|
*/
|
514
512
|
|
515
|
-
|
516
|
-
/** @scope
|
513
|
+
Ember.Gesture = Ember.Object.extend(
|
514
|
+
/** @scope Ember.Gesture.prototype */{
|
517
515
|
|
518
516
|
/**
|
519
517
|
The current state of the gesture recognizer. This value can be any one
|
@@ -525,7 +523,7 @@ SC.Gesture = SC.Object.extend(
|
|
525
523
|
|
526
524
|
/**
|
527
525
|
A string of the gesture recognizer's name. This value is set automatically
|
528
|
-
but
|
526
|
+
but Ember.Gestures when a gesture is registered.
|
529
527
|
|
530
528
|
@type String
|
531
529
|
*/
|
@@ -571,7 +569,7 @@ SC.Gesture = SC.Object.extend(
|
|
571
569
|
|
572
570
|
init: function() {
|
573
571
|
this._super();
|
574
|
-
this.touches =
|
572
|
+
this.touches = Ember.TouchList.create();
|
575
573
|
},
|
576
574
|
|
577
575
|
//..............................................
|
@@ -611,7 +609,7 @@ SC.Gesture = SC.Object.extend(
|
|
611
609
|
/** @private */
|
612
610
|
attemptGestureEventDelivery: function(evt, view, eventName, stopPropagation) {
|
613
611
|
if (stopPropagation === undefined) {
|
614
|
-
|
612
|
+
stopPropagation = true;
|
615
613
|
}
|
616
614
|
|
617
615
|
if (this.notifyViewOfGestureEvent(view, eventName) === false) {
|
@@ -689,7 +687,7 @@ SC.Gesture = SC.Object.extend(
|
|
689
687
|
var handler = view[eventName];
|
690
688
|
var result = true;
|
691
689
|
|
692
|
-
if (
|
690
|
+
if (Ember.typeOf(handler) === 'function') {
|
693
691
|
result = handler.call(view, this, data);
|
694
692
|
}
|
695
693
|
|
@@ -697,7 +695,7 @@ SC.Gesture = SC.Object.extend(
|
|
697
695
|
},
|
698
696
|
|
699
697
|
toString: function() {
|
700
|
-
return
|
698
|
+
return Ember.Gesture+'<'+Ember.guidFor(this)+'>';
|
701
699
|
},
|
702
700
|
|
703
701
|
/** @private */
|
@@ -726,15 +724,15 @@ SC.Gesture = SC.Object.extend(
|
|
726
724
|
}
|
727
725
|
|
728
726
|
if (_touches.get('length') < get(this, 'numberOfRequiredTouches')) {
|
729
|
-
set(this ,'state',
|
727
|
+
set(this ,'state', Ember.Gesture.WAITING_FOR_TOUCHES);
|
730
728
|
|
731
729
|
} else {
|
732
730
|
// Discrete gestures may skip the possible step if they're ready to begin
|
733
731
|
if (get(this, 'gestureIsDiscrete') && this.shouldBegin()) {
|
734
|
-
set(this, 'state',
|
732
|
+
set(this, 'state', Ember.Gesture.BEGAN);
|
735
733
|
this.didBegin();
|
736
734
|
} else {
|
737
|
-
set(this, 'state',
|
735
|
+
set(this, 'state', Ember.Gesture.POSSIBLE);
|
738
736
|
this.didBecomePossible();
|
739
737
|
}
|
740
738
|
}
|
@@ -746,7 +744,7 @@ SC.Gesture = SC.Object.extend(
|
|
746
744
|
touchMove: function(evt, view, manager) {
|
747
745
|
var state = get(this, 'state');
|
748
746
|
|
749
|
-
if (state ===
|
747
|
+
if (state === Ember.Gesture.WAITING_FOR_TOUCHES || state === Ember.Gesture.ENDED || state === Ember.Gesture.CANCELLED) {
|
750
748
|
// Nothing to do here
|
751
749
|
manager.redispatchEventToView(view,'touchmove', evt);
|
752
750
|
return;
|
@@ -763,9 +761,9 @@ SC.Gesture = SC.Object.extend(
|
|
763
761
|
_touches.updateTouch(touch);
|
764
762
|
}
|
765
763
|
|
766
|
-
if (state ===
|
764
|
+
if (state === Ember.Gesture.POSSIBLE) {
|
767
765
|
if (this.shouldBegin()) {
|
768
|
-
set(this, 'state',
|
766
|
+
set(this, 'state', Ember.Gesture.BEGAN);
|
769
767
|
this.didBegin();
|
770
768
|
|
771
769
|
// Give the gesture a chance to update its state so the view can get
|
@@ -776,8 +774,8 @@ SC.Gesture = SC.Object.extend(
|
|
776
774
|
}
|
777
775
|
|
778
776
|
// Discrete gestures don't fire changed events
|
779
|
-
} else if ((state ===
|
780
|
-
set(this, 'state',
|
777
|
+
} else if ((state === Ember.Gesture.BEGAN || state === Ember.Gesture.CHANGED) && !get(this, 'gestureIsDiscrete')) {
|
778
|
+
set(this, 'state', Ember.Gesture.CHANGED);
|
781
779
|
this.didChange();
|
782
780
|
|
783
781
|
this.attemptGestureEventDelivery(evt, view, get(this, 'name')+'Change');
|
@@ -793,19 +791,19 @@ SC.Gesture = SC.Object.extend(
|
|
793
791
|
if (get(this, 'gestureIsDiscrete')) {
|
794
792
|
|
795
793
|
// Discrete gestures use shouldEnd to either accept or decline the gesture.
|
796
|
-
if (this.state ===
|
797
|
-
set(this, 'state',
|
794
|
+
if (this.state === Ember.Gesture.BEGAN && this.shouldEnd()) {
|
795
|
+
set(this, 'state', Ember.Gesture.ENDED);
|
798
796
|
this.didEnd();
|
799
797
|
this.attemptGestureEventDelivery(evt, view, get(this, 'name')+'End');
|
800
798
|
} else {
|
801
|
-
set(this, 'state',
|
799
|
+
set(this, 'state', Ember.Gesture.CANCELLED);
|
802
800
|
this.didCancel();
|
803
801
|
this.attemptGestureEventDelivery(evt, view, get(this, 'name')+'Cancel');
|
804
802
|
}
|
805
803
|
}
|
806
804
|
else {
|
807
|
-
if ((this.state ===
|
808
|
-
set(this, 'state',
|
805
|
+
if ((this.state === Ember.Gesture.BEGAN || this.state === Ember.Gesture.CHANGED) && this.shouldEnd()) {
|
806
|
+
set(this, 'state', Ember.Gesture.ENDED);
|
809
807
|
this.didEnd();
|
810
808
|
|
811
809
|
this.attemptGestureEventDelivery(evt, view, get(this, 'name')+'End');
|
@@ -819,9 +817,9 @@ SC.Gesture = SC.Object.extend(
|
|
819
817
|
|
820
818
|
/** @private */
|
821
819
|
touchCancel: function(evt, view, manager) {
|
822
|
-
if (this.state !==
|
820
|
+
if (this.state !== Ember.Gesture.CANCELLED) {
|
823
821
|
this._resetState();
|
824
|
-
set(this, 'state',
|
822
|
+
set(this, 'state', Ember.Gesture.CANCELLED);
|
825
823
|
this.notifyViewOfGestureEvent(view,get(this, 'name')+'Cancel');
|
826
824
|
} else {
|
827
825
|
manager.redispatchEventToView(view,'touchcancel', evt);
|
@@ -829,12 +827,12 @@ SC.Gesture = SC.Object.extend(
|
|
829
827
|
}
|
830
828
|
});
|
831
829
|
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
830
|
+
Ember.Gesture.WAITING_FOR_TOUCHES = 0;
|
831
|
+
Ember.Gesture.POSSIBLE = 1;
|
832
|
+
Ember.Gesture.BEGAN = 2;
|
833
|
+
Ember.Gesture.CHANGED = 3;
|
834
|
+
Ember.Gesture.ENDED = 4;
|
835
|
+
Ember.Gesture.CANCELLED = 4;
|
838
836
|
|
839
837
|
})({});
|
840
838
|
|
@@ -846,8 +844,8 @@ SC.Gesture.CANCELLED = 4;
|
|
846
844
|
// License: Licensed under MIT license (see license.js)
|
847
845
|
// ==========================================================================
|
848
846
|
|
849
|
-
var get =
|
850
|
-
var set =
|
847
|
+
var get = Ember.get;
|
848
|
+
var set = Ember.set;
|
851
849
|
|
852
850
|
var sigFigs = 100;
|
853
851
|
|
@@ -860,7 +858,7 @@ var sigFigs = 100;
|
|
860
858
|
For pinchChange events, the pinch gesture recognizer includes a scale property
|
861
859
|
which can be applied as a CSS transform directly.
|
862
860
|
|
863
|
-
var myview =
|
861
|
+
var myview = Ember.View.create({
|
864
862
|
elementId: 'gestureTest',
|
865
863
|
|
866
864
|
pinchChange: function(rec) {
|
@@ -873,7 +871,7 @@ var sigFigs = 100;
|
|
873
871
|
You can specify how many touches the gesture requires to start using the numberOfRequiredTouches
|
874
872
|
property, which you can set in the pinchOptions hash:
|
875
873
|
|
876
|
-
var myview =
|
874
|
+
var myview = Ember.View.create({
|
877
875
|
pinchOptions: {
|
878
876
|
numberOfRequiredTouches: 3
|
879
877
|
}
|
@@ -881,9 +879,9 @@ var sigFigs = 100;
|
|
881
879
|
})
|
882
880
|
|
883
881
|
|
884
|
-
@extends
|
882
|
+
@extends Ember.Gesture
|
885
883
|
*/
|
886
|
-
|
884
|
+
Ember.PinchGestureRecognizer = Ember.Gesture.extend({
|
887
885
|
|
888
886
|
/**
|
889
887
|
The scale value which represents the current amount of scaling that has been applied
|
@@ -973,7 +971,7 @@ SC.PinchGestureRecognizer = SC.Gesture.extend({
|
|
973
971
|
}
|
974
972
|
});
|
975
973
|
|
976
|
-
|
974
|
+
Ember.Gestures.register('pinch', Ember.PinchGestureRecognizer);
|
977
975
|
|
978
976
|
})({});
|
979
977
|
|
@@ -985,8 +983,8 @@ SC.Gestures.register('pinch', SC.PinchGestureRecognizer);
|
|
985
983
|
// License: Licensed under MIT license (see license.js)
|
986
984
|
// ==========================================================================
|
987
985
|
|
988
|
-
var get =
|
989
|
-
var set =
|
986
|
+
var get = Ember.get;
|
987
|
+
var set = Ember.set;
|
990
988
|
var x = 0;
|
991
989
|
|
992
990
|
/**
|
@@ -1000,7 +998,7 @@ var x = 0;
|
|
1000
998
|
which can be applied as a CSS transform directly. Translation values are hashes
|
1001
999
|
which contain an x and a y value.
|
1002
1000
|
|
1003
|
-
var myview =
|
1001
|
+
var myview = Ember.View.create({
|
1004
1002
|
elementId: 'gestureTest',
|
1005
1003
|
|
1006
1004
|
panChange: function(rec) {
|
@@ -1015,16 +1013,16 @@ var x = 0;
|
|
1015
1013
|
You can specify how many touches the gesture requires to start using the numberOfRequiredTouches
|
1016
1014
|
property, which you can set in the panOptions hash:
|
1017
1015
|
|
1018
|
-
var myview =
|
1016
|
+
var myview = Ember.View.create({
|
1019
1017
|
panOptions: {
|
1020
1018
|
numberOfRequiredTouches: 3
|
1021
1019
|
}
|
1022
1020
|
...
|
1023
1021
|
})
|
1024
1022
|
|
1025
|
-
@extends
|
1023
|
+
@extends Ember.Gesture
|
1026
1024
|
*/
|
1027
|
-
|
1025
|
+
Ember.PanGestureRecognizer = Ember.Gesture.extend({
|
1028
1026
|
|
1029
1027
|
/**
|
1030
1028
|
The translation value which represents the current amount of movement that has been applied
|
@@ -1102,7 +1100,7 @@ SC.PanGestureRecognizer = SC.Gesture.extend({
|
|
1102
1100
|
}
|
1103
1101
|
});
|
1104
1102
|
|
1105
|
-
|
1103
|
+
Ember.Gestures.register('pan', Ember.PanGestureRecognizer);
|
1106
1104
|
|
1107
1105
|
})({});
|
1108
1106
|
|
@@ -1114,8 +1112,8 @@ SC.Gestures.register('pan', SC.PanGestureRecognizer);
|
|
1114
1112
|
// License: Licensed under MIT license (see license.js)
|
1115
1113
|
// ==========================================================================
|
1116
1114
|
|
1117
|
-
var get =
|
1118
|
-
var set =
|
1115
|
+
var get = Ember.get;
|
1116
|
+
var set = Ember.set;
|
1119
1117
|
|
1120
1118
|
/**
|
1121
1119
|
@class
|
@@ -1124,7 +1122,7 @@ var set = SC.set;
|
|
1124
1122
|
of wiggle-room between a start and end of a touch. Taps are discrete gestures
|
1125
1123
|
so only tapEnd() will get fired on a view.
|
1126
1124
|
|
1127
|
-
var myview =
|
1125
|
+
var myview = Ember.View.create({
|
1128
1126
|
elementId: 'gestureTest',
|
1129
1127
|
|
1130
1128
|
tapEnd: function(recognizer) {
|
@@ -1135,7 +1133,7 @@ var set = SC.set;
|
|
1135
1133
|
You can specify how many touches the gesture requires to start using the numberOfRequiredTouches
|
1136
1134
|
property, which you can set in the panOptions hash:
|
1137
1135
|
|
1138
|
-
var myview =
|
1136
|
+
var myview = Ember.View.create({
|
1139
1137
|
tapOptions: {
|
1140
1138
|
numberOfTaps: 3
|
1141
1139
|
}
|
@@ -1145,9 +1143,9 @@ var set = SC.set;
|
|
1145
1143
|
And you can also specify the number of taps required for the gesture to fire using the numberOfTaps
|
1146
1144
|
property.
|
1147
1145
|
|
1148
|
-
@extends
|
1146
|
+
@extends Ember.Gesture
|
1149
1147
|
*/
|
1150
|
-
|
1148
|
+
Ember.TapGestureRecognizer = Ember.Gesture.extend({
|
1151
1149
|
|
1152
1150
|
/**
|
1153
1151
|
The translation value which represents the current amount of movement that has been applied
|
@@ -1219,7 +1217,7 @@ SC.TapGestureRecognizer = SC.Gesture.extend({
|
|
1219
1217
|
}
|
1220
1218
|
});
|
1221
1219
|
|
1222
|
-
|
1220
|
+
Ember.Gestures.register('tap', Ember.TapGestureRecognizer);
|
1223
1221
|
|
1224
1222
|
})({});
|
1225
1223
|
|
@@ -1238,21 +1236,21 @@ SC.Gestures.register('tap', SC.TapGestureRecognizer);
|
|
1238
1236
|
// License: Licensed under MIT license (see license.js)
|
1239
1237
|
// ==========================================================================
|
1240
1238
|
|
1241
|
-
var get =
|
1242
|
-
var set =
|
1239
|
+
var get = Ember.get;
|
1240
|
+
var set = Ember.set;
|
1243
1241
|
|
1244
1242
|
/**
|
1245
1243
|
@class
|
1246
1244
|
|
1247
|
-
Extends
|
1245
|
+
Extends Ember.View by making the init method gesture-aware.
|
1248
1246
|
|
1249
|
-
@extends
|
1247
|
+
@extends Ember.Object
|
1250
1248
|
*/
|
1251
|
-
|
1252
|
-
/** @scope
|
1249
|
+
Ember.View.reopen(
|
1250
|
+
/** @scope Ember.View.prototype */{
|
1253
1251
|
|
1254
1252
|
/**
|
1255
|
-
The
|
1253
|
+
The Ember.GestureManager instance which will manager the gestures of the view.
|
1256
1254
|
This object is automatically created and set at init-time.
|
1257
1255
|
|
1258
1256
|
@default null
|
@@ -1267,7 +1265,7 @@ SC.View.reopen(
|
|
1267
1265
|
init: function() {
|
1268
1266
|
this._super();
|
1269
1267
|
|
1270
|
-
var knownGestures =
|
1268
|
+
var knownGestures = Ember.Gestures.knownGestures();
|
1271
1269
|
var eventManager = get(this, 'eventManager');
|
1272
1270
|
|
1273
1271
|
if (knownGestures && !eventManager) {
|
@@ -1290,7 +1288,7 @@ SC.View.reopen(
|
|
1290
1288
|
}
|
1291
1289
|
}
|
1292
1290
|
|
1293
|
-
var manager =
|
1291
|
+
var manager = Ember.GestureManager.create({
|
1294
1292
|
gestures: gestures
|
1295
1293
|
});
|
1296
1294
|
|