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

Scale #2

Open
crysan opened this issue Mar 22, 2011 · 17 comments
Open

Scale #2

crysan opened this issue Mar 22, 2011 · 17 comments

Comments

@crysan
Copy link

crysan commented Mar 22, 2011

I would like to get scale. It is necessary when you resize the layer.
Thank you!

@lennym
Copy link

lennym commented Jun 27, 2012

Check out #8

@gaucho1978
Copy link

what do you mean? what is the problem behaviour?

CAUSE I found aproblem: On chrome for android, if you zoom on the webpage (pinch outside of the schetchpad) and then you start to draw with the finger, the drawing appears on another screen location.
if you zoom out the webpage , the schetchpad restart to work correctly.
the problem does not appear on safari for ios devices.
Is your problem the same as mine?

@rmsandu
Copy link

rmsandu commented Sep 5, 2016

@gaucho1978 I think what you are referring to are problems with android/iOS compatibility which I solved using #6.

Scale in this case #10 is for if I want to zoom in on the sketchpad itself and the strokes drawn on it - not on the entire webpage.

@gaucho1978
Copy link

gaucho1978 commented Sep 5, 2016

thank you. I go to #6 and see.

@gaucho1978
Copy link

@raluca-san are you sure you pointed the correct link? it seems that #6 was wrote by someone else.
moreover that solution does nothing about zoom on the page.
I'm using similar solution: taktran@2e91f94
This allows android and ipad to corretly draw.
The problem still persists in my case when i zoom in the webpage from my android device:
I zoom the page, then when i draw a line it is shown not under my finger but in another place.
Can you try this in your implementation?

@gaucho1978
Copy link

do you have a link to share, where it is working?

@rmsandu
Copy link

rmsandu commented Sep 5, 2016

@gaucho1978
Zooming on Raphael Sketchpad and Zooming on the webpage are two different things.

  1. If I want to zoom in solely in raphael sketchpad , this means the webpage around it stays the same size while the sketchpad window increases/decreases in size then I use Add support for scaling editor and viewer sketches #10 and attach it under some button click event or mouse wheel event for zooming in/out. So in the case of the mobile device you can use some buttons and the scale function behind them (no mouse there :p). This solution works for me on adroid/ipad etc

  2. From what I get you want to zoom the entire webpage and you expect the raphael sketchpad editor window to zoom in as well simultaneously and draw correctly. I think the incorrect drawing position is because of the window size scaling and indeed I meant this solution Add support for scaling editor and viewer sketches #10 . I don't know if it will work also on fingers pinching. If it doesn't I suggest approach 1) referenced above

@gaucho1978
Copy link

ok, I will try #10

@gaucho1978
Copy link

I tried #10 but the problem is still there on chrome for android.

@gaucho1978
Copy link

gaucho1978 commented Sep 5, 2016

I must go for solution 2 because in the same page there are also combobox, input fields so the user needs to pinch the webpage to fill all the fields (the webpage is not optimized for mobile).
I don't understand why it works on safari for ios and not on chrome for android.
I don't understand why you talk about window size. where the sketchpad is created? isn't it created in relation with the html page geometry?

@gaucho1978
Copy link

Note: on Firefox for IOS the problem is not present.

@gaucho1978
Copy link

Note2: on CHROME for IOS the problem is not present!! so it seems not to be a problem of CHrome... may be a problem of android?

@gaucho1978
Copy link

Note3: on Firefox for Android the problem is not present. So it seems that it is not a problem of android neither of webkit (cause chrome and firefox use webkit). It's a specific problem of chrome on android.. WHY???

@gaucho1978
Copy link

gaucho1978 commented Sep 6, 2016

Note4: on Opera for Android and on Android embedded browser the problem is present
Note5: on chrome beta version (for android) the problem is present

@gaucho1978
Copy link

I found an interesting starting point to debug the problem: http://www.developerhandbook.com/other/how-to-debug-websites-on-your-mobile-device-using-google-chrome/

@gaucho1978
Copy link

I found the problem but not the solution.
In raphael.js the position of the mouse is determined by
_offset = $(sketchpad.container()).offset();
var x = e.pageX - _offset.left
y = e.pageY - _offset.top ;

the problem is that offset() returns a value affected by the zoom/scroll ONLY ON CHROME FOR ANDROID

@gaucho1978
Copy link

problems solved: gaucho1978@fe1c437

it is a bug related to offset() call that appears on chrome for android after a pinch.
I solved it.
I also allowed the ability to pinch and pan with 2 fingers and to draw with one finger.
i also made some other minor changes. see them all on the link.

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

4 participants