I tried a pixmap editor component and ran into strange offsets
Component has a private Image of same size as component
here is what i do
void PixMain::mouseDown (const MouseEvent &e){
svedPt.setXY(e.x,e.y);
}
void PixMain::mouseDrag(const MouseEvent &e){
Graphics g(*canvas);
float mx = (float) e.x;
float my = (float) e.y;
float omx = svedPt.getX();
float omy = svedPt.getY();
if( (my != omy) || (mx != omx)) {
g.lineTo(mx,my);
repaint();
svedPt.setXY(mx, my);
}
}
then:
void PixMain::paint (Graphics& g)
{
g.drawImage(canvas,0,
0,
getWidth(),
getHeight(),
0,
0,
canvas->getWidth(),
canvas->getHeight());
}
But what happens is, that the farther I move from topleft corner, the more mouse cursor and drawn line differ. Looks like a multiplicative factor being applied.
Jules: What is happening here?
Thanks