|
86 | 86 | startEvent: null,
|
87 | 87 | pointerUp : {},
|
88 | 88 |
|
89 |
| - xe: 0, |
90 |
| - ye: 0, |
91 |
| - sx: 0, |
92 |
| - sy: 0, |
93 |
| - duration: 0, |
| 89 | + xe: 0, ye: 0, |
| 90 | + sx: 0, sy: 0, |
94 | 91 |
|
95 | 92 | t0: 0,
|
96 |
| - vx0: 0, |
97 |
| - vys: 0, |
| 93 | + vx0: 0, vys: 0, |
| 94 | + duration: 0, |
98 | 95 |
|
99 | 96 | resumeDx: 0,
|
100 | 97 | resumeDy: 0,
|
|
200 | 197 | autoScrollEnabled: false,
|
201 | 198 |
|
202 | 199 | inertia: {
|
203 |
| - resistance : 10, // the lambda in exponential decay |
204 |
| - minSpeed : 100, // target speed must be above this for inertia to start |
205 |
| - endSpeed : 10, // the speed at which inertia is slow enough to stop |
206 |
| - actions : ['drag', 'resize'], |
207 |
| - zeroResumeDelta: false, |
208 |
| - smoothEndDuration: 300, |
| 200 | + resistance : 10, // the lambda in exponential decay |
| 201 | + minSpeed : 100, // target speed must be above this for inertia to start |
| 202 | + endSpeed : 10, // the speed at which inertia is slow enough to stop |
| 203 | + zeroResumeDelta : false, // if an action is resumed after launch, set dx/dy to 0 |
| 204 | + smoothEndDuration: 300, // animate to snap/restrict endOnly if there's no inertia |
| 205 | + actions : ['drag', 'resize'], // allow inertia on these actions. gesture might not work |
209 | 206 |
|
210 | 207 | numberTypes: /^resistance$|^minSpeed$|^endSpeed$|^smoothEndDuration$/,
|
211 | 208 | arrayTypes : /^actions$/,
|
212 |
| - boolTypes: /^zeroResumeDelta$/ |
| 209 | + boolTypes : /^zeroResumeDelta$/ |
213 | 210 | },
|
214 | 211 | inertiaEnabled: false,
|
215 | 212 |
|
216 | 213 | origin : { x: 0, y: 0 },
|
217 | 214 | deltaSource : 'page',
|
218 | 215 |
|
219 |
| - context : document // the Node on which querySelector will be called |
| 216 | + context : document // the Node on which querySelector will be called |
220 | 217 | },
|
221 | 218 |
|
222 | 219 | snapStatus = {
|
223 | 220 | locked : false,
|
224 |
| - x : 0, |
225 |
| - y : 0, |
226 |
| - dx : 0, |
227 |
| - dy : 0, |
228 |
| - realX : 0, |
229 |
| - realY : 0, |
| 221 | + x : 0, y : 0, |
| 222 | + dx : 0, dy : 0, |
| 223 | + realX : 0, realY : 0, |
230 | 224 | anchors: [],
|
231 | 225 | paths : []
|
232 | 226 | },
|
233 | 227 |
|
234 | 228 | restrictStatus = {
|
235 |
| - dx: 0, |
236 |
| - dy: 0, |
| 229 | + dx: 0, dy: 0, |
237 | 230 | snap: snapStatus,
|
238 | 231 | restricted: false
|
239 | 232 | },
|
|
242 | 235 | autoScroll = {
|
243 | 236 | target: null,
|
244 | 237 | i: null, // the handle returned by window.setInterval
|
245 |
| - x: 0, // Direction each pulse is to scroll in |
246 |
| - y: 0, |
| 238 | + x: 0, y: 0, // Direction each pulse is to scroll in |
247 | 239 |
|
248 | 240 | // scroll the window by the values in scroll.x/y
|
249 | 241 | scroll: function () {
|
|
346 | 338 | // is to be added after pointerDown
|
347 | 339 | actions = {
|
348 | 340 | drag: {
|
349 |
| - cursor : 'move', |
350 |
| - start: dragStart, |
351 |
| - move: dragMove |
| 341 | + cursor: 'move', |
| 342 | + start : dragStart, |
| 343 | + move : dragMove |
352 | 344 | },
|
353 | 345 | resizex: {
|
354 |
| - cursor : 'e-resize', |
355 |
| - start: resizeStart, |
356 |
| - move: resizeMove |
| 346 | + cursor: 'e-resize', |
| 347 | + start : resizeStart, |
| 348 | + move : resizeMove |
357 | 349 | },
|
358 | 350 | resizey: {
|
359 |
| - cursor : 's-resize', |
360 |
| - start: resizeStart, |
361 |
| - move: resizeMove |
| 351 | + cursor: 's-resize', |
| 352 | + start : resizeStart, |
| 353 | + move : resizeMove |
362 | 354 | },
|
363 | 355 | resizexy: {
|
364 |
| - cursor : 'se-resize', |
365 |
| - start: resizeStart, |
366 |
| - move: resizeMove |
| 356 | + cursor: 'se-resize', |
| 357 | + start : resizeStart, |
| 358 | + move : resizeMove |
367 | 359 | },
|
368 | 360 | gesture: {
|
369 |
| - cursor : '', |
370 |
| - start: gestureStart, |
371 |
| - move: gestureMove |
| 361 | + cursor: '', |
| 362 | + start : gestureStart, |
| 363 | + move : gestureMove |
372 | 364 | }
|
373 | 365 | },
|
374 | 366 |
|
|
379 | 371 | },
|
380 | 372 |
|
381 | 373 | // Action that's ready to be fired on next move event
|
382 |
| - prepared = null, |
| 374 | + prepared = null, |
383 | 375 |
|
384 | 376 | // because Webkit and Opera still use 'mousewheel' event type
|
385 | 377 | wheelEvent = 'onmousewheel' in document? 'mousewheel': 'wheel',
|
|
436 | 428 | cancelFrame = window.cancelAnimationFrame,
|
437 | 429 |
|
438 | 430 | // used for adding event listeners to window and document
|
439 |
| - windowTarget = { |
440 |
| - _element: window, |
441 |
| - events : {} |
442 |
| - }, |
443 |
| - docTarget = { |
444 |
| - _element: document, |
445 |
| - events : {} |
446 |
| - }, |
447 |
| - parentWindowTarget = { |
448 |
| - _element: window.parent, |
449 |
| - events : {} |
450 |
| - }, |
451 |
| - parentDocTarget = { |
452 |
| - _element: null, |
453 |
| - events : {} |
454 |
| - }, |
| 431 | + windowTarget = { _element: window , events : {} }, |
| 432 | + docTarget = { _element: document , events : {} }, |
| 433 | + parentWindowTarget = { _element: window.parent, events : {} }, |
| 434 | + parentDocTarget = { _element: null , events : {} }, |
455 | 435 |
|
456 | 436 | // Events wrapper
|
457 | 437 | events = (function () {
|
|
674 | 654 | targetObj.pageVY = targetObj.pageY / dt;
|
675 | 655 |
|
676 | 656 | targetObj.clientSpeed = hypot(targetObj.clientX, targetObj.pageY) / dt;
|
677 |
| - targetObj.clientVX = targetObj.clientX / dt; |
678 |
| - targetObj.clientVY = targetObj.clientY / dt; |
| 657 | + targetObj.clientVX = targetObj.clientX / dt; |
| 658 | + targetObj.clientVY = targetObj.clientY / dt; |
679 | 659 | }
|
680 | 660 |
|
681 | 661 | // Get specified X/Y coords for mouse or event.touches[0]
|
|
0 commit comments