question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to change `snappable` or `snapThreshold` value after initializing moveable

See original GitHub issue

Environments

  • 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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
daybrushcommented, Nov 15, 2021

@seahindeniz

  • moveable 0.27.2
  • react-moveable 0.30.2
  • preact-moveable 0.29.2
  • ngx-moveable 0.23.2
  • svelte-moveable 0.18.2
  • lit-moveable 0.4.2
  • vue-moveable 2.0.0-beta.5
  • vue3-moveable 0.2.2

moveable’s new version is released. Check it again.

1reaction
daybrushcommented, Nov 11, 2021

@seahindeniz

What doesn’t change is a bug. The dependency seems to be the problem. I’ll check.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found