0

I have a function like this:-

function dragMap(evt){
  if (mousemode == 'pan'){
    Snap('#zoombox').drag(move, start, stop);
  }
}
dragMap();

My challenge is when variable mousemode changes to something else, e.g. mousemode == 'simple'

even then the following drag code continues to show its effect on dragging Element(#zoombox).

Snap('#zoombox').drag(move, start, stop);

I want that dragging shall work/execute ONLY WHEN variable mousemode is set to 'pan'. What should be way forward?

gaurav
  • 15
  • 3

1 Answers1

1

Couple of options.

  1. Snap('#zoombox').undrag() whenever mousemode changes.

  2. Write your own drag handler. There's a couple of examples here. Just add a check for your variable inside the functions.

Ian
  • 13,724
  • 4
  • 52
  • 75