-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Push * format * capture:true for pointerup->click to avoid runnig click after drag is done * Add documentation * Add changesets
- Loading branch information
Showing
10 changed files
with
352 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"@neodrag/core": patch | ||
"@neodrag/react": patch | ||
"@neodrag/solid": patch | ||
"@neodrag/svelte": patch | ||
"@neodrag/vanilla": patch | ||
"@neodrag/vue": patch | ||
--- | ||
|
||
fix: drag end no longer causes onclick to trigger. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
"@neodrag/core": minor | ||
"@neodrag/react": minor | ||
"@neodrag/solid": minor | ||
"@neodrag/svelte": minor | ||
"@neodrag/vanilla": minor | ||
"@neodrag/vue": minor | ||
--- | ||
|
||
feat: threshold option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
{ | ||
"react": { | ||
"size": "2.01", | ||
"size": "2.20", | ||
"version": "2.0.4" | ||
}, | ||
"svelte": { | ||
"size": "1.97", | ||
"version": "2.0.6" | ||
}, | ||
"solid": { | ||
"size": "1.99", | ||
"version": "2.0.4" | ||
}, | ||
"vue": { | ||
"size": "1.81", | ||
"size": "1.99", | ||
"version": "2.0.4" | ||
}, | ||
"vanilla": { | ||
"size": "1.84", | ||
"size": "2.01", | ||
"version": "2.0.5" | ||
}, | ||
"solid": { | ||
"size": "1.80", | ||
"version": "2.0.4" | ||
}, | ||
"svelte": { | ||
"size": "1.78", | ||
"version": "2.0.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
title: threshold | ||
type: '{ distance?: number; delay?: number }' | ||
defaultValue: '{ distance: 3, delay: 0 }' | ||
--- | ||
|
||
import Code from '$components/options/OptionsCode.astro'; | ||
import Example from '$components/options/OptionsExample.astro'; | ||
import Examples from '$components/options/OptionsExamples.svelte'; | ||
|
||
import DelayExample from './Delay.example.svelte'; | ||
import DistanceExample from './Distance.example.svelte'; | ||
|
||
export const shortDescription = | ||
"Threshold for dragging to start. If the user moves the mouse/finger less than this distance, the dragging won't start."; | ||
|
||
Allows you to set a threshold for dragging to start. If the user moves the mouse/finger less than this distance, the dragging won't start. Or user must hold the mouse/finger for the specified delay for dragging to begin. | ||
|
||
<Examples client:load> | ||
<Example> | ||
<DelayExample client:visible slot="demo" /> | ||
|
||
<Code slot="codes"> | ||
<div slot="svelte"> | ||
```svelte | ||
<div use:draggable={{ threshold: { delay: 200 } }}> | ||
200ms Delay | ||
</div> | ||
``` | ||
</div> | ||
|
||
<div slot="vue"> | ||
```vue | ||
<template> | ||
<div v-draggable="{{ threshold: { delay: 200 } }}"> | ||
200ms Delay | ||
</div> | ||
</template> | ||
``` | ||
</div> | ||
|
||
<div slot="solid"> | ||
```jsx | ||
<div use:draggable={{ threshold: { delay: 200 } }}> | ||
200ms Delay | ||
</div> | ||
``` | ||
</div> | ||
|
||
<div slot="react"> | ||
```ts | ||
useDraggable(draggableRef, { threshold: { delay: 200 } }); | ||
``` | ||
</div> | ||
|
||
<div slot="vanilla"> | ||
```js | ||
new Draggable(el, { threshold: { delay: 200 } }); | ||
``` | ||
</div> | ||
|
||
</Code> | ||
|
||
</Example> | ||
|
||
<Example> | ||
<DistanceExample client:visible slot="demo" /> | ||
|
||
<Code slot="codes"> | ||
<div slot="svelte"> | ||
```svelte | ||
<div use:draggable={{ threshold: { distance: 100 } }}> | ||
100px distance | ||
</div> | ||
``` | ||
</div> | ||
|
||
<div slot="vue"> | ||
```vue | ||
<template> | ||
<div v-draggable="{{ threshold: { distance: 100 } }}"> | ||
100px distance | ||
</div> | ||
</template> | ||
``` | ||
</div> | ||
|
||
<div slot="solid"> | ||
```jsx | ||
<div use:draggable={{ threshold: { distance: 100 } }}> | ||
100px distance | ||
</div> | ||
``` | ||
</div> | ||
|
||
<div slot="react"> | ||
```ts | ||
useDraggable(draggableRef, { threshold: { distance: 100 } }); | ||
``` | ||
</div> | ||
|
||
<div slot="vanilla"> | ||
```js | ||
new Draggable(el, { threshold: { distance: 100 } }); | ||
``` | ||
</div> | ||
|
||
</Code> | ||
|
||
</Example> | ||
</Examples> |
13 changes: 13 additions & 0 deletions
13
docs/src/documentation/options/threshold/Delay.example.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script lang="ts"> | ||
import OptionsDemoBase from '$components/options/OptionsDemoBase.svelte'; | ||
</script> | ||
|
||
<OptionsDemoBase | ||
options={{ | ||
threshold: { | ||
delay: 200, | ||
}, | ||
}} | ||
> | ||
200ms delay | ||
</OptionsDemoBase> |
13 changes: 13 additions & 0 deletions
13
docs/src/documentation/options/threshold/Distance.example.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script lang="ts"> | ||
import OptionsDemoBase from '$components/options/OptionsDemoBase.svelte'; | ||
</script> | ||
|
||
<OptionsDemoBase | ||
options={{ | ||
threshold: { | ||
distance: 100, | ||
}, | ||
}} | ||
> | ||
100px distance | ||
</OptionsDemoBase> |
Oops, something went wrong.