Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom button for rotate: mouseDown / mouseUp ? #525

Closed
issimissimo opened this issue Mar 4, 2021 · 3 comments
Closed

Custom button for rotate: mouseDown / mouseUp ? #525

issimissimo opened this issue Mar 4, 2021 · 3 comments

Comments

@issimissimo
Copy link

Hello,
I'm trying to make custom buttons to rotate left, tight, top, bottom, in a continuous way (as long as the button is pressed the image keep rotating).
The problem is that the OnClick property of the custom button does not pass the element (the button) to another function, so I can't detect when the mouse is released from the button.
Is there a way to detect "OnMouseUp" (or something like that) from custom button?

@mistic100
Copy link
Owner

it does not matter where you listen to the mouseup even as long as it is a parent of the button, for exemple document

the zoom buttons actually listen to mouseup on the parent container, but it could be document
https://github.com/mistic100/Photo-Sphere-Viewer/blob/dev/src/buttons/AbstractZoomButton.js#L35

if would be awesome if could propose such buttons in the core. Actually all the base logic is already implemented in AbstractZoomButton, it should be simple to create an AbstractMaintainButton used for both zoom and navigation buttons

@issimissimo
Copy link
Author

Many thanks @mistic100 , as usual!
Unfortunately actually I don't have time to implement this button in the core, but I'll do.
For now I've just ended up with a dirty solution:
viewer.navbar.container.addEventListener('mouseup', function () { console.log("MOUSE UP") });

@mistic100
Copy link
Owner

I track this feature in a new ticket : #526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants