moveable icon indicating copy to clipboard operation
moveable copied to clipboard

Is there a way to re-set elementGuidelines?

Open corey34 opened this issue 2 years ago • 2 comments

Environments

  • Framework name: vanilla JS
  • Framework version: latest

Description

The elementGuidelines option seems to only work for elements already on the DOM. If I add a new moveable element, elementGuidlines work perfectly when moving that element. However when moving a different element, the elementGuidelines do not work with that latest added element. Is there a way to re-set so that all elements work correctly?

Thanks

corey34 avatar Mar 16 '22 19:03 corey34

Something like this should do the job

const moveable = new Moveable(container, {
  elementGuidelines: returnYourGuidelines(),
  // ...rest of your config
});

moveable.on('drag', () => {
  // set again here
  moveable.elementGuidelines = returnYourNewGuidelines();
});

seahindeniz avatar Mar 17 '22 08:03 seahindeniz

Thanks that helped

corey34 avatar Mar 19 '22 15:03 corey34