|
3665 | 3665 | snap = {};
|
3666 | 3666 | }
|
3667 | 3667 |
|
3668 |
| - snap.mode = this.validateSetting('snap', 'mode' , options.mode); |
3669 |
| - snap.endOnly = this.validateSetting('snap', 'endOnly' , options.endOnly); |
3670 |
| - snap.actions = this.validateSetting('snap', 'actions' , options.actions); |
3671 |
| - snap.range = this.validateSetting('snap', 'range' , options.range); |
3672 |
| - snap.paths = this.validateSetting('snap', 'paths' , options.paths); |
3673 |
| - snap.grid = this.validateSetting('snap', 'grid' , options.grid); |
3674 |
| - snap.gridOffset = this.validateSetting('snap', 'gridOffset', options.gridOffset); |
3675 |
| - snap.anchors = this.validateSetting('snap', 'anchors' , options.anchors); |
3676 |
| - snap.elementOrigin = this.validateSetting('snap', 'elementOrigin' , options.elementOrigin); |
| 3668 | + snap.mode = this.validateSetting('snap', 'mode' , options.mode); |
| 3669 | + snap.endOnly = this.validateSetting('snap', 'endOnly' , options.endOnly); |
| 3670 | + snap.actions = this.validateSetting('snap', 'actions' , options.actions); |
| 3671 | + snap.range = this.validateSetting('snap', 'range' , options.range); |
| 3672 | + snap.paths = this.validateSetting('snap', 'paths' , options.paths); |
| 3673 | + snap.grid = this.validateSetting('snap', 'grid' , options.grid); |
| 3674 | + snap.gridOffset = this.validateSetting('snap', 'gridOffset' , options.gridOffset); |
| 3675 | + snap.anchors = this.validateSetting('snap', 'anchors' , options.anchors); |
| 3676 | + snap.elementOrigin = this.validateSetting('snap', 'elementOrigin', options.elementOrigin); |
3677 | 3677 |
|
3678 | 3678 | this.options.snapEnabled = true;
|
3679 | 3679 | this.options.snap = snap;
|
|
3727 | 3727 | | // inertia will stop when the object slows down to this speed
|
3728 | 3728 | | endSpeed : 20,
|
3729 | 3729 | |
|
3730 |
| - | // an array of action types that can have inertia (no gesture) |
3731 |
| - | actions : ['drag', 'resize'], |
3732 |
| - | |
3733 | 3730 | | // boolean; should the jump when resuming from inertia be ignored in event.dx/dy
|
3734 |
| - | zeroResumeDelta: false |
| 3731 | + | zeroResumeDelta: false, |
| 3732 | + | |
| 3733 | + | // if snap/restrict are set to be endOnly and inertia is enabled, releasing |
| 3734 | + | // the pointer without triggering inertia will animate from the release |
| 3735 | + | // point to the snaped/restricted point in the given amount of time (ms) |
| 3736 | + | smoothEndDuration: 300, |
| 3737 | + | |
| 3738 | + | // an array of action types that can have inertia (no gesture) |
| 3739 | + | actions : ['drag', 'resize'] |
3735 | 3740 | | });
|
3736 | 3741 | |
|
3737 | 3742 | | // reset custom settings and use all defaults
|
|
3745 | 3750 |
|
3746 | 3751 | if (inertia === defaults) {
|
3747 | 3752 | inertia = this.options.inertia = {
|
3748 |
| - resistance : defaults.resistance, |
3749 |
| - minSpeed : defaults.minSpeed, |
3750 |
| - endSpeed : defaults.endSpeed, |
3751 |
| - actions : defaults.actions, |
3752 |
| - zeroResumeDelta: defaults.zeroResumeDelta, |
| 3753 | + resistance : defaults.resistance, |
| 3754 | + minSpeed : defaults.minSpeed, |
| 3755 | + endSpeed : defaults.endSpeed, |
| 3756 | + actions : defaults.actions, |
| 3757 | + zeroResumeDelta : defaults.zeroResumeDelta, |
3753 | 3758 | smoothEndDuration: defaults.smoothEndDuration
|
3754 | 3759 | };
|
3755 | 3760 | }
|
3756 | 3761 |
|
3757 |
| - inertia.resistance = this.validateSetting('inertia', 'resistance' , options.resistance); |
3758 |
| - inertia.minSpeed = this.validateSetting('inertia', 'minSpeed' , options.minSpeed); |
3759 |
| - inertia.endSpeed = this.validateSetting('inertia', 'endSpeed' , options.endSpeed); |
3760 |
| - inertia.actions = this.validateSetting('inertia', 'actions' , options.actions); |
3761 |
| - inertia.zeroResumeDelta = this.validateSetting('inertia', 'zeroResumeDelta', options.zeroResumeDelta); |
| 3762 | + inertia.resistance = this.validateSetting('inertia', 'resistance' , options.resistance); |
| 3763 | + inertia.minSpeed = this.validateSetting('inertia', 'minSpeed' , options.minSpeed); |
| 3764 | + inertia.endSpeed = this.validateSetting('inertia', 'endSpeed' , options.endSpeed); |
| 3765 | + inertia.actions = this.validateSetting('inertia', 'actions' , options.actions); |
| 3766 | + inertia.zeroResumeDelta = this.validateSetting('inertia', 'zeroResumeDelta' , options.zeroResumeDelta); |
3762 | 3767 | inertia.smoothEndDuration = this.validateSetting('inertia', 'smoothEndDuration', options.smoothEndDuration);
|
3763 | 3768 |
|
3764 | 3769 | this.options.inertiaEnabled = true;
|
|
4933 | 4938 | if (typeof options.mode === 'string' ) { snap.mode = options.mode; }
|
4934 | 4939 | if (typeof options.endOnly === 'boolean') { snap.endOnly = options.endOnly; }
|
4935 | 4940 | if (typeof options.range === 'number' ) { snap.range = options.range; }
|
4936 |
| - if (options.actions instanceof Array ) { snap.actions = options.actions; } |
4937 |
| - if (options.anchors instanceof Array ) { snap.anchors = options.anchors; } |
4938 |
| - if (options.grid instanceof Object) { snap.grid = options.grid; } |
4939 |
| - if (options.gridOffset instanceof Object) { snap.gridOffset = options.gridOffset; } |
| 4941 | + if (options.actions instanceof Array ) { snap.actions = options.actions; } |
| 4942 | + if (options.anchors instanceof Array ) { snap.anchors = options.anchors; } |
| 4943 | + if (options.grid instanceof Object) { snap.grid = options.grid; } |
| 4944 | + if (options.gridOffset instanceof Object) { snap.gridOffset = options.gridOffset; } |
4940 | 4945 | if (options.elementOrigin instanceof Object) { snap.elementOrigin = options.elementOrigin; }
|
4941 | 4946 |
|
4942 | 4947 | return interact;
|
|
4988 | 4993 | if (typeof options.resistance === 'number') { inertia.resistance = options.resistance;}
|
4989 | 4994 | if (typeof options.minSpeed === 'number') { inertia.minSpeed = options.minSpeed ;}
|
4990 | 4995 | if (typeof options.endSpeed === 'number') { inertia.endSpeed = options.endSpeed ;}
|
4991 |
| - if (typeof options.smoothEndDuration === 'number') { inertia.smoothEndDuration = options.smoothEndDuration ;} |
4992 |
| - |
4993 |
| - if (typeof options.zeroResumeDelta === 'boolean') { inertia.zeroResumeDelta = options.zeroResumeDelta ;} |
| 4996 | + if (typeof options.smoothEndDuration === 'number' ) { inertia.smoothEndDuration = options.smoothEndDuration;} |
| 4997 | + if (typeof options.zeroResumeDelta === 'boolean') { inertia.zeroResumeDelta = options.zeroResumeDelta ;} |
4994 | 4998 |
|
4995 | 4999 | if (options.actions instanceof Array) { inertia.actions = options.actions; }
|
4996 | 5000 |
|
|
0 commit comments