Ability to change `snappable` or `snapThreshold` value after initializing moveable
See original GitHub issueEnvironments
- Moveable Component version: 0.27.1
Description
There are some cases when I want to be able to change snappable
or snapThreshold
while dragging an element.
I have tried following way, but that didn’t work:
const moveableOptions = {
// ...
snappable: true,
snapThreshold: 5,
};
const moveable = new Moveable(container, moveableOptions);
const snapCount = 0
const snapHandler = () => {
if (snapCount !== 100) return;
moveableOptions.snapThreshold = 0;
moveable.snapThreshold = 0;
moveable.updateTarget();
};
this.moveable.on('snap', snapHandler);
Or
const moveableOptions = {
// ...
snappable: true,
snapThreshold: 5,
};
const moveable = new Moveable(container, moveableOptions);
const snapCount = 0
const snapHandler = () => {
if (snapCount !== 100) return;
moveableOptions.snappable = false;
moveable.snappable = false;
moveable.updateTarget();
};
this.moveable.on('snap', snapHandler);
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
moveable/CHANGELOG.md at master - GitHub
Change Log. All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
Read more >Network Transform - Unity - Manual
Snap Threshold, Set the threshold at which, if a movement update puts a GameObject ... the GameObject snaps to the position instead of...
Read more >Jumps back to top after scrolling - Google Groups
I've got an iScroll on an ajax page. The scrolling works, but jumps back to the top of the content after momentum stops....
Read more >Create Draggable/Resizable/Scalable/Rotatable/Warpable ...
Initialize the Moveable library and specify the target element. const moveable = new Moveable(document.body, { target: document.querySelector(".
Read more >"Snap-in failed to initialize" error message when you open ...
When you try to open a Microsoft Management Console snap-in that involves ... may receive an error message similar to one of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@seahindeniz
moveable
0.27.2react-moveable
0.30.2preact-moveable
0.29.2ngx-moveable
0.23.2svelte-moveable
0.18.2lit-moveable
0.4.2vue-moveable
2.0.0-beta.5vue3-moveable
0.2.2moveable’s new version is released. Check it again.
@seahindeniz
What doesn’t change is a bug. The dependency seems to be the problem. I’ll check.