@progress/kendo-charts 1.22.0 → 1.23.0-dev.202201170838

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/dist/cdn/js/kendo-charts.js +1 -1
  4. package/dist/cdn/main.js +1 -1
  5. package/dist/es/common/keys.js +25 -0
  6. package/dist/es/common.js +1 -0
  7. package/dist/es/drawing-utils.js +27 -3
  8. package/dist/es/main.js +1 -0
  9. package/dist/es/map/attribution.js +158 -0
  10. package/dist/es/map/crs.js +277 -0
  11. package/dist/es/map/datums.js +16 -0
  12. package/dist/es/map/extent.js +129 -0
  13. package/dist/es/map/layers/bubble.js +185 -0
  14. package/dist/es/map/layers/layer.js +140 -0
  15. package/dist/es/map/layers/marker.js +347 -0
  16. package/dist/es/map/layers/shape.js +389 -0
  17. package/dist/es/map/layers/tile.js +491 -0
  18. package/dist/es/map/location.js +201 -0
  19. package/dist/es/map/map.js +945 -0
  20. package/dist/es/map/navigator.js +175 -0
  21. package/dist/es/map/scroller/draggable.js +454 -0
  22. package/dist/es/map/scroller/fx.js +119 -0
  23. package/dist/es/map/scroller/observable.js +175 -0
  24. package/dist/es/map/scroller/scroller.js +746 -0
  25. package/dist/es/map/scroller/user-events.js +713 -0
  26. package/dist/es/map/utils.js +450 -0
  27. package/dist/es/map/zoom.js +139 -0
  28. package/dist/es/map.js +1 -0
  29. package/dist/es/services/map-service.js +15 -0
  30. package/dist/es2015/common/keys.js +25 -0
  31. package/dist/es2015/common.js +1 -0
  32. package/dist/es2015/drawing-utils.js +43 -3
  33. package/dist/es2015/main.js +1 -0
  34. package/dist/es2015/map/attribution.js +148 -0
  35. package/dist/es2015/map/crs.js +233 -0
  36. package/dist/es2015/map/datums.js +16 -0
  37. package/dist/es2015/map/extent.js +115 -0
  38. package/dist/es2015/map/layers/bubble.js +167 -0
  39. package/dist/es2015/map/layers/layer.js +134 -0
  40. package/dist/es2015/map/layers/marker.js +327 -0
  41. package/dist/es2015/map/layers/shape.js +369 -0
  42. package/dist/es2015/map/layers/tile.js +465 -0
  43. package/dist/es2015/map/location.js +193 -0
  44. package/dist/es2015/map/map.js +915 -0
  45. package/dist/es2015/map/navigator.js +170 -0
  46. package/dist/es2015/map/scroller/draggable.js +418 -0
  47. package/dist/es2015/map/scroller/fx.js +112 -0
  48. package/dist/es2015/map/scroller/observable.js +165 -0
  49. package/dist/es2015/map/scroller/scroller.js +716 -0
  50. package/dist/es2015/map/scroller/user-events.js +695 -0
  51. package/dist/es2015/map/utils.js +450 -0
  52. package/dist/es2015/map/zoom.js +134 -0
  53. package/dist/es2015/map.js +1 -0
  54. package/dist/es2015/services/map-service.js +15 -0
  55. package/dist/npm/main.d.ts +1 -0
  56. package/dist/npm/main.js +6218 -342
  57. package/dist/npm/map.d.ts +4 -0
  58. package/dist/systemjs/kendo-charts.js +1 -1
  59. package/package.json +1 -1
@@ -0,0 +1,746 @@
1
+ // todo: extract to a separate place
2
+
3
+ import {
4
+ Class,
5
+ deepExtend,
6
+ addClass,
7
+ isFunction,
8
+ setDefaultOptions
9
+ } from '../../common';
10
+
11
+ import {
12
+ convertToHtml,
13
+ prepend,
14
+ wrapInner,
15
+ contains,
16
+ hasNativeScrolling,
17
+ on,
18
+ off,
19
+ proxy,
20
+ wheelDeltaY,
21
+ setDefaultEvents
22
+ } from '../utils';
23
+
24
+ import {
25
+ Transition,
26
+ Animation
27
+ } from './fx';
28
+
29
+ import {
30
+ Pane,
31
+ PaneDimensions,
32
+ Movable,
33
+ TapCapture
34
+ } from './draggable';
35
+
36
+ import {
37
+ UserEvents
38
+ } from './user-events';
39
+
40
+ import {
41
+ Observable
42
+ } from './observable';
43
+
44
+ var
45
+ extend = Object.assign,
46
+ abs = Math.abs,
47
+ SNAPBACK_DURATION = 500,
48
+ SCROLLBAR_OPACITY = 0.7,
49
+ FRICTION = 0.96,
50
+ VELOCITY_MULTIPLIER = 10,
51
+ MAX_VELOCITY = 55,
52
+ OUT_OF_BOUNDS_FRICTION = 0.5,
53
+ ANIMATED_SCROLLER_PRECISION = 5,
54
+ // SCROLLER_RELEASE_CLASS = 'km-scroller-release',
55
+ // SCROLLER_REFRESH_CLASS = 'km-scroller-refresh',
56
+ PULL = 'pull',
57
+ CHANGE = 'change',
58
+ RESIZE = 'resize',
59
+ SCROLL = 'scroll',
60
+ MOUSE_WHEEL_ID = 2;
61
+
62
+ var ZoomSnapBack = (function (Animation) {
63
+ function ZoomSnapBack(options) {
64
+ Animation.call(this, options);
65
+ var that = this;
66
+ extend(that, options);
67
+ that.userEvents.bind('gestureend', that.start.bind(this));
68
+ that.tapCapture.bind('press', that.cancel.bind(this));
69
+ }
70
+
71
+ if ( Animation ) ZoomSnapBack.__proto__ = Animation;
72
+ ZoomSnapBack.prototype = Object.create( Animation && Animation.prototype );
73
+ ZoomSnapBack.prototype.constructor = ZoomSnapBack;
74
+
75
+ ZoomSnapBack.prototype.enabled = function enabled () {
76
+ return this.movable.scale < this.dimensions.minScale;
77
+ };
78
+
79
+ ZoomSnapBack.prototype.done = function done () {
80
+ return this.dimensions.minScale - this.movable.scale < 0.01;
81
+ };
82
+
83
+ ZoomSnapBack.prototype.tick = function tick () {
84
+ var movable = this.movable;
85
+ movable.scaleWith(1.1);
86
+ this.dimensions.rescale(movable.scale);
87
+ };
88
+
89
+ ZoomSnapBack.prototype.onEnd = function onEnd () {
90
+ var movable = this.movable;
91
+ movable.scaleTo(this.dimensions.minScale);
92
+ this.dimensions.rescale(movable.scale);
93
+ };
94
+
95
+ return ZoomSnapBack;
96
+ }(Animation));
97
+
98
+ var DragInertia = (function (Animation) {
99
+ function DragInertia(options) {
100
+ Animation.call(this);
101
+ var that = this;
102
+
103
+ extend(that, options, {
104
+ transition: new Transition({
105
+ axis: options.axis,
106
+ movable: options.movable,
107
+ onEnd: function onEnd() {
108
+ that._end();
109
+ }
110
+ })
111
+ });
112
+
113
+ that.tapCapture.bind('press', function() {
114
+ that.cancel();
115
+ });
116
+
117
+ that.userEvents.bind('end', proxy(that.start, that));
118
+ that.userEvents.bind('gestureend', proxy(that.start, that));
119
+ that.userEvents.bind('tap', proxy(that.onEnd, that));
120
+ }
121
+
122
+ if ( Animation ) DragInertia.__proto__ = Animation;
123
+ DragInertia.prototype = Object.create( Animation && Animation.prototype );
124
+ DragInertia.prototype.constructor = DragInertia;
125
+
126
+ DragInertia.prototype.onCancel = function onCancel () {
127
+ this.transition.cancel();
128
+ };
129
+
130
+ DragInertia.prototype.freeze = function freeze (location) {
131
+ var that = this;
132
+ that.cancel();
133
+ that._moveTo(location);
134
+ };
135
+
136
+ DragInertia.prototype.onEnd = function onEnd () {
137
+ var that = this;
138
+ if (that.paneAxis.outOfBounds()) {
139
+ that._snapBack();
140
+ } else {
141
+ that._end();
142
+ }
143
+ };
144
+
145
+ DragInertia.prototype.done = function done () {
146
+ return abs(this.velocity) < 1;
147
+ };
148
+
149
+ DragInertia.prototype.start = function start (e) {
150
+ var that = this,
151
+ velocity;
152
+ if (!that.dimension.enabled) {
153
+ return;
154
+ }
155
+ if (that.paneAxis.outOfBounds()) {
156
+ if (that.transition._started) {
157
+ that.transition.cancel();
158
+ that.velocity = Math.min(e.touch[that.axis].velocity * that.velocityMultiplier, MAX_VELOCITY);
159
+ Animation.prototype.start.call(this);
160
+ } else {
161
+ that._snapBack();
162
+ }
163
+ } else {
164
+ velocity = e.touch.id === MOUSE_WHEEL_ID ? 0 : e.touch[that.axis].velocity;
165
+ that.velocity = Math.max(Math.min(velocity * that.velocityMultiplier, MAX_VELOCITY), -MAX_VELOCITY);
166
+ that.tapCapture.captureNext();
167
+ Animation.prototype.start.call(this);
168
+ }
169
+ };
170
+
171
+ DragInertia.prototype.tick = function tick () {
172
+ var that = this,
173
+ dimension = that.dimension,
174
+ friction = that.paneAxis.outOfBounds() ? OUT_OF_BOUNDS_FRICTION : that.friction,
175
+ delta = that.velocity *= friction,
176
+ location = that.movable[that.axis] + delta;
177
+
178
+ if (!that.elastic && dimension.outOfBounds(location)) {
179
+ location = Math.max(Math.min(location, dimension.max), dimension.min);
180
+ that.velocity = 0;
181
+ }
182
+
183
+ that.movable.moveAxis(that.axis, location);
184
+ };
185
+
186
+ DragInertia.prototype._end = function _end () {
187
+ this.tapCapture.cancelCapture();
188
+ this.end();
189
+ };
190
+
191
+ DragInertia.prototype._snapBack = function _snapBack () {
192
+ var that = this,
193
+ dimension = that.dimension,
194
+ snapBack = that.movable[that.axis] > dimension.max ? dimension.max : dimension.min;
195
+
196
+ that._moveTo(snapBack);
197
+ };
198
+
199
+ DragInertia.prototype._moveTo = function _moveTo (location) {
200
+ this.transition.moveTo({
201
+ location: location,
202
+ duration: SNAPBACK_DURATION,
203
+ ease: Transition.easeOutExpo
204
+ });
205
+ };
206
+
207
+ return DragInertia;
208
+ }(Animation));
209
+
210
+ var AnimatedScroller = (function (Animation) {
211
+ function AnimatedScroller(options) {
212
+ Animation.call(this, options);
213
+ var that = this;
214
+
215
+ extend(that, options, {
216
+ origin: {},
217
+ destination: {},
218
+ offset: {}
219
+ });
220
+ }
221
+
222
+ if ( Animation ) AnimatedScroller.__proto__ = Animation;
223
+ AnimatedScroller.prototype = Object.create( Animation && Animation.prototype );
224
+ AnimatedScroller.prototype.constructor = AnimatedScroller;
225
+
226
+ AnimatedScroller.prototype.tick = function tick () {
227
+ this._updateCoordinates();
228
+ this.moveTo(this.origin);
229
+ };
230
+
231
+ AnimatedScroller.prototype.done = function done () {
232
+ return abs(this.offset.y) < ANIMATED_SCROLLER_PRECISION && abs(this.offset.x) < ANIMATED_SCROLLER_PRECISION;
233
+ };
234
+
235
+ AnimatedScroller.prototype.onEnd = function onEnd () {
236
+ this.moveTo(this.destination);
237
+ if (this.callback) {
238
+ this.callback.call();
239
+ }
240
+ };
241
+
242
+ AnimatedScroller.prototype.setCoordinates = function setCoordinates (from, to) {
243
+ this.offset = {};
244
+ this.origin = from;
245
+ this.destination = to;
246
+ };
247
+
248
+ /* eslint-disable no-param-reassign */
249
+ AnimatedScroller.prototype.setCallback = function setCallback (callback) {
250
+ if (callback && isFunction(callback)) {
251
+ this.callback = callback;
252
+ } else {
253
+ callback = undefined;
254
+ }
255
+ };
256
+ /* eslint-enable no-param-reassign */
257
+
258
+ AnimatedScroller.prototype._updateCoordinates = function _updateCoordinates () {
259
+ this.offset = {
260
+ x: (this.destination.x - this.origin.x) / 4,
261
+ y: (this.destination.y - this.origin.y) / 4
262
+ };
263
+ this.origin = {
264
+ y: this.origin.y + this.offset.y,
265
+ x: this.origin.x + this.offset.x
266
+ };
267
+ };
268
+
269
+ return AnimatedScroller;
270
+ }(Animation));
271
+
272
+ var ScrollBar = (function (Class) {
273
+ function ScrollBar(options) {
274
+ Class.call(this);
275
+ var that = this,
276
+ horizontal = options.axis === 'x';
277
+
278
+ var orientation = (horizontal ? 'horizontal' : 'vertical');
279
+ var element = convertToHtml('<div class="km-touch-scrollbar km-' + orientation + '-scrollbar" />');
280
+
281
+ extend(that, options, {
282
+ element: element,
283
+ elementSize: 0,
284
+ movable: new Movable(element),
285
+ scrollMovable: options.movable,
286
+ alwaysVisible: options.alwaysVisible,
287
+ size: horizontal ? 'width' : 'height'
288
+ });
289
+
290
+ that.scrollMovable.bind(CHANGE, that.refresh.bind(that));
291
+
292
+ that.container.appendChild(element);
293
+
294
+ if (options.alwaysVisible) {
295
+ that.show();
296
+ }
297
+ }
298
+
299
+ if ( Class ) ScrollBar.__proto__ = Class;
300
+ ScrollBar.prototype = Object.create( Class && Class.prototype );
301
+ ScrollBar.prototype.constructor = ScrollBar;
302
+
303
+ ScrollBar.prototype.refresh = function refresh () {
304
+ var that = this,
305
+ axis = that.axis,
306
+ dimension = that.dimension,
307
+ paneSize = dimension.size,
308
+ scrollMovable = that.scrollMovable,
309
+ sizeRatio = paneSize / dimension.total,
310
+ position = Math.round(-scrollMovable[axis] * sizeRatio),
311
+ size = Math.round(paneSize * sizeRatio);
312
+ if (sizeRatio >= 1) {
313
+ this.element.style.display = "none";
314
+ } else {
315
+ this.element.style.display = "";
316
+ }
317
+ if (position + size > paneSize) {
318
+ size = paneSize - position;
319
+ } else if (position < 0) {
320
+ size += position;
321
+ position = 0;
322
+ }
323
+ if (that.elementSize !== size) {
324
+ that.element.style[that.size] = size + 'px';
325
+ that.elementSize = size;
326
+ }
327
+ that.movable.moveAxis(axis, position);
328
+ };
329
+
330
+ ScrollBar.prototype.show = function show () {
331
+ this.element.style.opacity = SCROLLBAR_OPACITY;
332
+ this.element.style.visibility = "visible";
333
+ };
334
+
335
+ ScrollBar.prototype.hide = function hide () {
336
+ if (!this.alwaysVisible) {
337
+ this.element.style.opacity = 0;
338
+ }
339
+ };
340
+
341
+ return ScrollBar;
342
+ }(Class));
343
+
344
+ // export class Scroller extends Class {
345
+ export var Scroller = (function (Observable) {
346
+ function Scroller(element, options) {
347
+ Observable.call(this);
348
+ var that = this;
349
+ this.element = element;
350
+
351
+ this._initOptions(options);
352
+
353
+ var hasScrolling = hasNativeScrolling(navigator.userAgent);
354
+ that._native = that.options.useNative && hasScrolling;
355
+ var scrollHeader = convertToHtml('<div class="km-scroll-header"/>');
356
+
357
+ if (that._native) {
358
+ addClass(element, 'km-native-scroller');
359
+ prepend(scrollHeader, element);
360
+
361
+ extend(that, {
362
+ scrollElement: element,
363
+ fixedContainer: element.children[0]
364
+ });
365
+
366
+ return;
367
+ }
368
+
369
+ element.style.overflow = "hidden";
370
+ addClass(element, 'km-scroll-wrapper');
371
+
372
+ var scrollContainer = convertToHtml('<div class="km-scroll-container"/>');
373
+ wrapInner(element, scrollContainer);
374
+ prepend(scrollHeader, element);
375
+
376
+ var inner = element.children[1],
377
+ tapCapture = new TapCapture(element),
378
+ movable = new Movable(inner),
379
+
380
+ dimensions = new PaneDimensions({
381
+ element: inner,
382
+ container: element,
383
+ forcedEnabled: that.options.zoom
384
+ }),
385
+ avoidScrolling = this.options.avoidScrolling,
386
+
387
+ userEvents = new UserEvents(element, {
388
+ touchAction: 'pan-y',
389
+ fastTap: true,
390
+ allowSelection: true,
391
+ preventDragEvent: true,
392
+ captureUpIfMoved: true,
393
+ multiTouch: that.options.zoom,
394
+ supportDoubleTap: that.options.supportDoubleTap,
395
+ start: function start(e) {
396
+ dimensions.refresh();
397
+ var velocityX = abs(e.x.velocity),
398
+ velocityY = abs(e.y.velocity),
399
+ horizontalSwipe = velocityX * 2 >= velocityY,
400
+ originatedFromFixedContainer = contains(that.fixedContainer, e.event.target),
401
+ verticalSwipe = velocityY * 2 >= velocityX;
402
+ if (!originatedFromFixedContainer && !avoidScrolling(e) && that.enabled && (dimensions.x.enabled && horizontalSwipe || dimensions.y.enabled && verticalSwipe)) {
403
+ userEvents.capture();
404
+ } else {
405
+ userEvents.cancel();
406
+ }
407
+ }
408
+ }),
409
+
410
+ pane = new Pane({
411
+ movable: movable,
412
+ dimensions: dimensions,
413
+ userEvents: userEvents,
414
+ elastic: that.options.elastic
415
+ }),
416
+
417
+ zoomSnapBack = new ZoomSnapBack({
418
+ movable: movable,
419
+ dimensions: dimensions,
420
+ userEvents: userEvents,
421
+ tapCapture: tapCapture
422
+ }),
423
+
424
+ animatedScroller = new AnimatedScroller({
425
+ moveTo: function moveTo(coordinates) {
426
+ that.scrollTo(coordinates.x, coordinates.y);
427
+ }
428
+ });
429
+
430
+ movable.bind(CHANGE, function() {
431
+ that.scrollTop = -movable.y;
432
+ that.scrollLeft = -movable.x;
433
+ that.trigger(SCROLL, {
434
+ scrollTop: that.scrollTop,
435
+ scrollLeft: that.scrollLeft
436
+ });
437
+ });
438
+
439
+ if (that.options.mousewheelScrolling) {
440
+ this._wheelScrollHandler = this._wheelScroll.bind(this);
441
+ on(element, 'DOMMouseScroll mousewheel', this._wheelScrollHandler);
442
+ }
443
+
444
+ extend(that, {
445
+ movable: movable,
446
+ dimensions: dimensions,
447
+ zoomSnapBack: zoomSnapBack,
448
+ animatedScroller: animatedScroller,
449
+ userEvents: userEvents,
450
+ pane: pane,
451
+ tapCapture: tapCapture,
452
+ pulled: false,
453
+ enabled: true,
454
+ scrollElement: inner,
455
+ scrollTop: 0,
456
+ scrollLeft: 0,
457
+ fixedContainer: element.children[0]
458
+ });
459
+
460
+ that._initAxis('x');
461
+ that._initAxis('y');
462
+
463
+ that._wheelEnd = function() {
464
+ that._wheel = false;
465
+ that.userEvents.end(0, that._wheelY);
466
+ };
467
+
468
+ dimensions.refresh();
469
+
470
+ if (that.options.pullToRefresh) {
471
+ that._initPullToRefresh();
472
+ }
473
+ }
474
+
475
+ if ( Observable ) Scroller.__proto__ = Observable;
476
+ Scroller.prototype = Object.create( Observable && Observable.prototype );
477
+ Scroller.prototype.constructor = Scroller;
478
+
479
+ Scroller.prototype._initOptions = function _initOptions (options) {
480
+ this.options = deepExtend({}, this.options, options);
481
+ };
482
+
483
+ Scroller.prototype._wheelScroll = function _wheelScroll (e) {
484
+ if (e.ctrlKey) {
485
+ return;
486
+ }
487
+ if (!this._wheel) {
488
+ this._wheel = true;
489
+ this._wheelY = 0;
490
+ this.userEvents.press(0, this._wheelY);
491
+ }
492
+
493
+ clearTimeout(this._wheelTimeout);
494
+ this._wheelTimeout = setTimeout(this._wheelEnd, 50);
495
+ var delta = wheelDeltaY(e);
496
+
497
+ if (delta) {
498
+ this._wheelY += delta;
499
+ this.userEvents.move(0, this._wheelY);
500
+ }
501
+
502
+ e.preventDefault();
503
+ };
504
+
505
+ Scroller.prototype.makeVirtual = function makeVirtual () {
506
+ this.dimensions.y.makeVirtual();
507
+ };
508
+
509
+ Scroller.prototype.virtualSize = function virtualSize (min, max) {
510
+ this.dimensions.y.virtualSize(min, max);
511
+ };
512
+
513
+ Scroller.prototype.height = function height () {
514
+ return this.dimensions.y.size;
515
+ };
516
+
517
+ Scroller.prototype.scrollHeight = function scrollHeight () {
518
+ return this.scrollElement.scrollHeight;
519
+ };
520
+
521
+ Scroller.prototype.scrollWidth = function scrollWidth () {
522
+ return this.scrollElement.scrollWidth;
523
+ };
524
+
525
+ Scroller.prototype._resize = function _resize () {
526
+ if (!this._native) {
527
+ this.contentResized();
528
+ }
529
+ };
530
+
531
+ Scroller.prototype.setOptions = function setOptions (options) {
532
+ var that = this;
533
+
534
+ this._initOptions(options);
535
+
536
+ if (options.pullToRefresh) {
537
+ that._initPullToRefresh();
538
+ }
539
+ };
540
+
541
+ Scroller.prototype.reset = function reset () {
542
+ if (this._native) {
543
+ this.scrollElement.scrollTop(0);
544
+ } else {
545
+ this.movable.moveTo({
546
+ x: 0,
547
+ y: 0
548
+ });
549
+ this._scale(1);
550
+ }
551
+ };
552
+
553
+ Scroller.prototype.contentResized = function contentResized () {
554
+ this.dimensions.refresh();
555
+ if (this.pane.x.outOfBounds()) {
556
+ this.movable.moveAxis('x', this.dimensions.x.min);
557
+ }
558
+ if (this.pane.y.outOfBounds()) {
559
+ this.movable.moveAxis('y', this.dimensions.y.min);
560
+ }
561
+ };
562
+
563
+ Scroller.prototype.zoomOut = function zoomOut () {
564
+ var dimensions = this.dimensions;
565
+ dimensions.refresh();
566
+ this._scale(dimensions.fitScale);
567
+ this.movable.moveTo(dimensions.centerCoordinates());
568
+ };
569
+
570
+ Scroller.prototype.enable = function enable () {
571
+ this.enabled = true;
572
+ };
573
+
574
+ Scroller.prototype.disable = function disable () {
575
+ this.enabled = false;
576
+ };
577
+
578
+ Scroller.prototype.scrollTo = function scrollTo (x, y) {
579
+ if (this._native) {
580
+ this.scrollElement.scrollLeft(abs(x));
581
+ this.scrollElement.scrollTop(abs(y));
582
+ } else {
583
+ this.dimensions.refresh();
584
+ this.movable.moveTo({
585
+ x: x,
586
+ y: y
587
+ });
588
+ }
589
+ };
590
+
591
+ Scroller.prototype.animatedScrollTo = function animatedScrollTo (x, y, callback) {
592
+ var from, to;
593
+ if (this._native) {
594
+ this.scrollTo(x, y);
595
+ } else {
596
+ from = {
597
+ x: this.movable.x,
598
+ y: this.movable.y
599
+ };
600
+ to = {
601
+ x: x,
602
+ y: y
603
+ };
604
+ this.animatedScroller.setCoordinates(from, to);
605
+ this.animatedScroller.setCallback(callback);
606
+ this.animatedScroller.start();
607
+ }
608
+ };
609
+
610
+ // kept for API compatibility, not used
611
+ Scroller.prototype.pullHandled = function pullHandled () {
612
+ // let that = this;
613
+
614
+ // removeClass(that.refreshHint, SCROLLER_REFRESH_CLASS);
615
+ // that.hintContainer.innerHTML = that.pullTemplate({}));
616
+
617
+ // that.yinertia.onEnd();
618
+ // that.xinertia.onEnd();
619
+ // that.userEvents.cancel();
620
+ };
621
+
622
+ Scroller.prototype.destroy = function destroy () {
623
+ var element = this.element;
624
+
625
+ off(element, 'DOMMouseScroll mousewheel', this._wheelScrollHandler);
626
+
627
+ if (this.userEvents) {
628
+ this.userEvents.destroy();
629
+ }
630
+ };
631
+
632
+ Scroller.prototype._scale = function _scale (scale) {
633
+ this.dimensions.rescale(scale);
634
+ this.movable.scaleTo(scale);
635
+ };
636
+
637
+ Scroller.prototype._initPullToRefresh = function _initPullToRefresh () {
638
+ };
639
+
640
+ // kept for API compatibility, not used
641
+ Scroller.prototype._dragEnd = function _dragEnd () {
642
+ // let that = this;
643
+
644
+ // if (!that.pulled) {
645
+ // return;
646
+ // }
647
+
648
+ // that.pulled = false;
649
+
650
+ // removeClass(that.refreshHint, SCROLLER_RELEASE_CLASS);
651
+ // addClass(that.refreshHint, SCROLLER_REFRESH_CLASS);
652
+
653
+ // that.hintContainer.innerHTML = that.refreshTemplate({});
654
+
655
+ // that.yinertia.freeze(that.options.pullOffset / 2);
656
+ // that.trigger('pull');
657
+ };
658
+
659
+ // kept for API compatibility, not used
660
+ Scroller.prototype._paneChange = function _paneChange () {
661
+ // let that = this;
662
+ // if (that.movable.y / OUT_OF_BOUNDS_FRICTION > that.options.pullOffset) {
663
+ // if (!that.pulled) {
664
+ // that.pulled = true;
665
+ // that.refreshHint.removeClass(SCROLLER_REFRESH_CLASS).addClass(SCROLLER_RELEASE_CLASS);
666
+ // that.hintContainer.html(that.releaseTemplate({}));
667
+ // that.hintContainer.html(that.releaseTemplate({}));
668
+ // }
669
+ // } else if (that.pulled) {
670
+ // that.pulled = false;
671
+ // that.refreshHint.removeClass(SCROLLER_RELEASE_CLASS);
672
+ // that.hintContainer.html(that.pullTemplate({}));
673
+ // }
674
+ };
675
+
676
+ Scroller.prototype._initAxis = function _initAxis (axis) {
677
+ var that = this,
678
+ movable = that.movable,
679
+ dimension = that.dimensions[axis],
680
+ tapCapture = that.tapCapture,
681
+ paneAxis = that.pane[axis],
682
+ scrollBar = new ScrollBar({
683
+ axis: axis,
684
+ movable: movable,
685
+ dimension: dimension,
686
+ container: that.element,
687
+ alwaysVisible: that.options.visibleScrollHints
688
+ });
689
+
690
+ dimension.bind(CHANGE, function() {
691
+ scrollBar.refresh();
692
+ });
693
+
694
+ paneAxis.bind(CHANGE, function() {
695
+ scrollBar.show();
696
+ });
697
+
698
+ that[axis + 'inertia'] = new DragInertia({
699
+ axis: axis,
700
+ paneAxis: paneAxis,
701
+ movable: movable,
702
+ tapCapture: tapCapture,
703
+ userEvents: that.userEvents,
704
+ dimension: dimension,
705
+ elastic: that.options.elastic,
706
+ friction: that.options.friction || FRICTION,
707
+ velocityMultiplier: that.options.velocityMultiplier || VELOCITY_MULTIPLIER,
708
+ end: function end() {
709
+ scrollBar.hide();
710
+ that.trigger('scrollEnd', {
711
+ axis: axis,
712
+ scrollTop: that.scrollTop,
713
+ scrollLeft: that.scrollLeft
714
+ });
715
+ }
716
+ });
717
+ };
718
+
719
+ return Scroller;
720
+ }(Observable));
721
+
722
+ setDefaultOptions(Scroller, {
723
+ name: 'Scroller',
724
+ zoom: false,
725
+ pullOffset: 140,
726
+ visibleScrollHints: false,
727
+ elastic: true,
728
+ useNative: false,
729
+ mousewheelScrolling: true,
730
+ avoidScrolling: function avoidScrolling() {
731
+ return false;
732
+ },
733
+ pullToRefresh: false,
734
+ messages: {
735
+ pullTemplate: 'Pull to refresh',
736
+ releaseTemplate: 'Release to refresh',
737
+ refreshTemplate: 'Refreshing'
738
+ }
739
+ });
740
+
741
+ setDefaultEvents(Scroller, [
742
+ PULL,
743
+ SCROLL,
744
+ RESIZE
745
+ ]);
746
+