PaintWeb issues in IE9

380 views
Skip to first unread message

mchaz84

unread,
Jun 10, 2011, 5:14:33 AM6/10/11
to PaintWeb discussions
Hello,

I have an issue with PaintWeb on IE9, when the window has a scrollbar
(when the paintweb object is not on top).

For exemple, with the demo file "demo1.html" :
- i add severals "<br/>" tags in the body after the image, to make the
body scrollbar appear
- the paintweb object loads fine
- if i don't scroll, no problem
- but when i scroll a little (so the paintweb object "move a little"
on the page), during the drawing, there is a difference of position
between the mouse and the draws...

Does anybody can confirm me the bug? Do you know how to fix that? I
think it's just a problem with calculating the cursor position in the
viewport...


Another problem in IE9 : i can't choose the color with the color
picker (in demo1.html for example)

Thanks for your help

mchaz84

unread,
Jun 11, 2011, 2:15:44 AM6/11/11
to PaintWeb discussions
For those interested, i think i found how to solve the problem of
scrolling. I don't know if it's the best way to proceed but for me it
seems to work fine :


in paintweb.src.js at the lines 4558, after the if...else condition :


if ('layerX' in ev) {
if (_self.image.canvasScale === 1) {
_self.mouse.x = ev.layerX;
_self.mouse.y = ev.layerY;
} else {
_self.mouse.x = MathRound(ev.layerX /
_self.image.canvasScale);
_self.mouse.y = MathRound(ev.layerY /
_self.image.canvasScale);
}
} else if ('offsetX' in ev) {
if (_self.image.canvasScale === 1) {
_self.mouse.x = ev.offsetX;
_self.mouse.y = ev.offsetY;
} else {
_self.mouse.x = MathRound(ev.offsetX /
_self.image.canvasScale);
_self.mouse.y = MathRound(ev.offsetY /
_self.image.canvasScale);
}
}


Add this condition juste after :

if (navigator.appName=='Microsoft Internet Explorer')
_self.mouse.y -= document.documentElement.scrollTop;


I hope it can help someone...
Otherwise, i still have the issue with the color picker, but it's not
so important. Paintweb is really cool, thanks to the author!

AndyB

unread,
Jun 26, 2011, 12:48:54 PM6/26/11
to PaintWeb discussions
Saved my day :) I'm working on integrating PaintWeb with Drupal in
Image Editor module. And I can confirm that the described issue is
present in Google Chrome 12 and MSIE 9.
Image Editor runs the editors in an overlay created with 2 divs that
have "position: fixed". And everything is fine if you scroll the
parent to top - but when you scroll it a bit lower then the lines are
starting to draw lower than you you want them to be.

Several notes:
1. The string reference should be around 14558, not 4558.
2. This fixes it only for IE (I just removed the if part of the fix -
so it should have affected all browsers, but still works only for IE)
3. I found another way to fix it (hopefully, for all browsers) - if
you have jQuery just add this line instead of the described condition:

_self.mouse.y -= jQuery(window).scrollTop();

Thanks
AndyB
Reply all
Reply to author
Forward
0 new messages