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

Coordinates are lost inside a div with scroll bar. #9

Closed
SaulBurgos opened this issue Nov 6, 2014 · 3 comments
Closed

Coordinates are lost inside a div with scroll bar. #9

SaulBurgos opened this issue Nov 6, 2014 · 3 comments

Comments

@SaulBurgos
Copy link

Hi I am trying to make a game for children , they need to discover images behind other images. But I have the canvas inside others div with scroll bars.

When you scroll down the coordinates of the brush are lost. Here an example:

http://jsfiddle.net/L0oaar7z/

Any idea of how to resolve this ?

@boblemarin
Copy link
Owner

If you really can't get rid of the scrolling divs, there might be some work to do on the plug-in.

Currently, it listens to the window.resize event to measure the position of the image relative to the page. This mechanism should be enabled for the scrolling events of the parent elements.

But I'm not entirely sure about how exactly, and sadly I don't really have the time right now to carry the research.

Please tell me if you find a solution for your case.

@SaulBurgos
Copy link
Author

I was working to fix the scroll problem and I changed a few things. recently you made a new commit so my changes are not according to them.

I do not know how to merge o contribute in github , I will left my change in this file:
https://drive.google.com/file/d/0BxqxrU9sY9CAX2pYc05iaFVqcGM/view

in the function called: 'evaluatePoint' I have made a change to use 'getImageData' because I needed to use very small brush size like 1px , the only problem is that your image need to be in the same server.

If anyone want to use it , you need to make a bridge in the server , something like this :

http://stackoverflow.com/questions/22097747/getimagedata-error-the-canvas-has-been-tainted-by-cross-origin-data

or

http://stackoverflow.com/questions/12629410/how-can-i-render-a-remote-image-with-php

The problem of the coordinates was solved using a comment of a user in this page:
http://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/

All congratulations to him.

@boblemarin
Copy link
Owner

It's great that you found a solution. Sadly, the requirement to host the image, or to implement a proxy page, might break things for current users if they update the plug-in.

I've been merging changes regarding high DPI devices, but they don't break existing use cases.

We should maybe keep your fork for people experiencing your specific problem, or make it a branch of the main repo. I'll look into the github details when I get some time.

Thanks for your fix.

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