Browse Source

+ touchStartThreshold (default by window.devicePixelRatio)

swap
RubaXa 7 years ago
parent
commit
8794188794
  1. 7
      README.md
  2. 4
      Sortable.js

7
README.md

@ -82,7 +82,7 @@ var sortable = new Sortable(el, {
group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] } group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] }
sort: true, // sorting inside list sort: true, // sorting inside list
delay: 0, // time in milliseconds to define when the sorting should start delay: 0, // time in milliseconds to define when the sorting should start
touchMoveSensitivity: 0, // px, how many pixels the point should move before cancelling a delayed drag event touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event
disabled: false, // Disables the sortable if set to true. disabled: false, // Disables the sortable if set to true.
store: null, // @see Store store: null, // @see Store
animation: 150, // ms, animation speed moving items when sorting, `0` — without animation animation: 150, // ms, animation speed moving items when sorting, `0` — without animation
@ -214,10 +214,10 @@ Demo: http://jsbin.com/xizeh/edit?html,js,output
--- ---
#### `touchMoveSensitivity` option #### `touchStartThreshold` option
This option is similar to `fallbackTolerance` option. This option is similar to `fallbackTolerance` option.
When the `delay` option is set, some phones with very sensitive touch displays like the Samsung Galaxy S8 will fire When the `delay` option is set, some phones with very sensitive touch displays like the Samsung Galaxy S8 will fire
unwanted touchmove events even when your finger is not moving, resulting in the sort not triggering. unwanted touchmove events even when your finger is not moving, resulting in the sort not triggering.
This option sets the minimum pointer movement that must occur before the delayed sorting is cancelled. This option sets the minimum pointer movement that must occur before the delayed sorting is cancelled.
@ -648,4 +648,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

4
Sortable.js

@ -282,7 +282,7 @@
dragoverBubble: false, dragoverBubble: false,
dataIdAttr: 'data-id', dataIdAttr: 'data-id',
delay: 0, delay: 0,
touchMoveSensitivity: 0, touchStartThreshold: parseInt(window.devicePixelRatio, 10) || 1,
forceFallback: false, forceFallback: false,
fallbackClass: 'sortable-fallback', fallbackClass: 'sortable-fallback',
fallbackOnBody: false, fallbackOnBody: false,
@ -477,7 +477,7 @@
}, },
_delayedDragTouchMoveHandler: function (/** TouchEvent|PointerEvent **/e) { _delayedDragTouchMoveHandler: function (/** TouchEvent|PointerEvent **/e) {
if (min(abs(e.clientX - this._lastX), abs(e.clientY - this._lastY)) > this.options.touchMoveSensitivity) { if (min(abs(e.clientX - this._lastX), abs(e.clientY - this._lastY)) >= this.options.touchStartThreshold) {
this._disableDelayedDrag(); this._disableDelayedDrag();
} }
}, },

Loading…
Cancel
Save