Add method to api to expose mouse move on panning#167
Open
wjdingman1 wants to merge 5 commits into
Open
Conversation
Owner
|
Would just listening to This seem equivalent: let left = panzoom(document.querySelector('.left img'))
let right = panzoom(document.querySelector('.right img'));
let lastX = 0; let lastY = 0;
left.on('panstart', function(e) {
let start = e.getTransform();
lastX = start.x; lastY = start.y;
});
left.on('pan', function(e) {
let current = e.getTransform();
let dx = current.x - lastX;
let dy = current.y - lastY;
lastX = current.x;
lastY = current.y;
right.moveBy(dx, dy);
});https://output.jsbin.com/betikus/2 - js fiddle to play. |
Author
|
Let me check and I'll get back to you, thanks for quick response!
My first intuition is no, since we are using single file vue components and
we are communicating between the two with an eventbus. The api change just
abstract away a lot of the 'heavy lifting'.
I'll keep you posted though.
Thanks again
…On Fri, Feb 7, 2020 at 12:54 AM Andrei Kashcha ***@***.***> wrote:
Would just listening to panstart and pan event work for your use case?
This seem equivalent:
let left = panzoom(document.querySelector('.left img'))let right = panzoom(document.querySelector('.right img'));
let lastX = 0; let lastY = 0;left.on('panstart', function(e) {
let start = e.getTransform();
lastX = start.x; lastY = start.y;
});
left.on('pan', function(e) {
let current = e.getTransform();
let dx = current.x - lastX;
let dy = current.y - lastY;
lastX = current.x;
lastY = current.y;
right.moveBy(dx, dy);
});
https://output.jsbin.com/betikus/2 - js fiddle to play.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#167?email_source=notifications&email_token=AI2QOO374BXRWJRFLNSDPBDRBTZP7A5CNFSM4KRAGZZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELBZ7JY#issuecomment-583245735>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI2QOOY5IISGTBYN5OOXQNLRBTZP7ANCNFSM4KRAGZZA>
.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Had a unique use case where we had to pan and zoom two separate images in unison.
This changes allows the user to get information about the movement of the mouse during a pan event so they can call sibling components and 'moveTo' that location.