You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firstly I would like to thank you for this tool, I loved!
I woud like to suggest to add a feature do Hover and Freeze, I had to improve the base code to do this trick.
I you like the ideia, here's the code I implemented using the "grab" mode:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Firstly I would like to thank you for this tool, I loved!
I woud like to suggest to add a feature do Hover and Freeze, I had to improve the base code to do this trick.
I you like the ideia, here's the code I implemented using the "grab" mode:
const onLeave = () => {
this.session = null;
this.template.detach();
unListenMove();
unListenLeave();
unListenWheel();
};
const onGrabLeave = () => {
this.template.detach();
unListenMove();
unListenLeave();
unListenWheel();
};
const onGrabOut = () => {
unListenMove();
unListenWheel();
};
const counter = () => {
this.count += 1
}
let unListenMove;
let unListenLeave;
const unListenWheel = this.renderer.listen(this.element.nativeElement, 'wheel', onWheel);
if (this.behavior === 'hover') {
unListenMove = this.renderer.listen(this.element.nativeElement, 'mousemove', onMove);
unListenLeave = this.renderer.listen(this.element.nativeElement, 'mouseleave', onLeave);
}
else if (this.behavior === 'click') {
unListenMove = () => { };
unListenLeave = this.renderer.listen(document, 'mousedown', (downEvent) => {
const element = this.element.nativeElement;
if (!element.contains(downEvent.target)) {
onLeave();
}
});
}
else {
const element = this.element.nativeElement;
counter()
this.isGrabbing = !this.isGrabbing;
if (this.isGrabbing && this.count < 3) {
unListenMove = this.renderer.listen(document, 'mousemove', onMove);
} else {
unListenMove = () => {};
unListenLeave = this.renderer.listen(document, 'mousedown', () => {
onGrabOut();
return
});
}
Beta Was this translation helpful? Give feedback.
All reactions