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

Updating zoom source during an active zoom #42

Closed
a2rampal opened this issue Sep 9, 2016 · 10 comments
Closed

Updating zoom source during an active zoom #42

a2rampal opened this issue Sep 9, 2016 · 10 comments

Comments

@a2rampal
Copy link

a2rampal commented Sep 9, 2016

Not sure if there is already a way to do this, but I am building an application where I am constantly changing the image that data-zoom is referring to. Essentially zooming on a video and using the screenshots as the zoom source.

Problem I am running into is that every time I have mouseover on the element (video), the zoom image is the screenshot from the time at the start of the mouseover. If I move off the element and come back, the image has been updated.

@paulstraw
Copy link
Member

Hmm… interesting use case. So you basically want it to act like a live viewfinder? How often are you updating the zoom source? I think the biggest issue here would be image load times, unless they're all already cached somehow. Thoughts?

@a2rampal
Copy link
Author

a2rampal commented Sep 9, 2016

I draw the video image to a canvas every 100ms to a second, so only one image is ever in play. Then I execute a toDataURL functon on the canvas to change what data-zoom is using.

@a2rampal
Copy link
Author

a2rampal commented Sep 9, 2016

I guess another question is how to toggle the Drift on and off. Thanks

@paulstraw
Copy link
Member

paulstraw commented Sep 9, 2016

Ah, so it's all local data. That makes things easier. I'm thinking I might just add a public API method for this. How does something like this sound to you?

EDITED:

var drift = new Drift(whateverSourceElement, {
  paneContainer: whateverContainerElement
});

function updateImage() {
  // draw to the canvas etc here

  drift.updateZoomImage();
}

@paulstraw
Copy link
Member

I edited the above example, so you should click through to the thread to see that. Whoops!

@a2rampal
Copy link
Author

a2rampal commented Sep 9, 2016

drift.updateZoomImage();

sounds exactly like what I would need.

The other thing is that I click a zoom button to enable and disable zoom. Any idea on the best way to disable the Drift?

@a2rampal a2rampal closed this as completed Sep 9, 2016
@a2rampal a2rampal reopened this Sep 9, 2016
@paulstraw
Copy link
Member

I suppose I should probably add that, as well. 🙂

I should be able to tackle these next week!

@paulstraw
Copy link
Member

Hey @a2rampal, thanks for your patience on this! I've added + released as 0.4.0.

@rosemoljoe
Copy link

rosemoljoe commented Feb 22, 2017

Hi

Can anyone help me on this issue ?

updateZoomImage doesn't work properly in Mozilla Firefox.
When changing the url for data-zoom, it doesn't show the loading screen. Instead it shows the previous image loaded. But this works perfectly in Google Chrome and Safari.

It happens when we use different image urls for setting src and data-zoom

@paulstraw

@paulstraw
Copy link
Member

Hey @RosemolJ, can you set up a CodePen (or similar) showing this issue in action?

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

3 participants