I'm working on drag and drop div and I have the following code:
void init() {
...
baseWindowTitleDiv.on.mouseDown.add((MouseEvent event) => saveWindowXY(event));
baseWindowTitleDiv.on.mouseUp.add((MouseEvent event) => stopMoveEvent(event));
...
}
void saveWindowXY(MouseEvent event) {
...
document.on.mouseMove.add((MouseEvent event) => runMoveEvent(event));
}
void stopMoveEvent(MouseEvent event) {
print('stopMoveEvent call');
document.on.mouseMove.remove((MouseEvent event) => runMoveEvent(event));//does not work!
}
void runMoveEvent(MouseEvent event) {
...
}
I do not understand how can I remove listener from document.on.mouseMove
Full code is here - https://gist.github.com/OZKA/5795352