Home » Community » Newbie corner » A little bug in the Scribble example program
A little bug in the Scribble example program [message #31731] |
Tue, 22 March 2011 00:51 |
Lance
Messages: 527 Registered: March 2007
|
Contributor |
|
|
There is a little step the program forgot to do, to translate mouse position in the viewport window to the underlaying image(paper) coordinates. This will result in if a user sets a size resulting in the scrollbar available and the user actually scroll some distance on either or both directions, the stroke positions will not be recorded and subsequently drawn correctly.
The change is simple and straightforward.
Two functions to record strokes will need to be touched
void Scribble::MouseMove(Point p, dword keyflags)
{
if(HasCapture()) {
image.Top().Add() = p+scroll;//<---HERE
Refresh();
}
}
void Scribble::LeftDown(Point p, dword keyflags)
{
image.Add().Add() = p+scroll;//<--AND HERE
SetCapture();
Refresh();
}
I came across this when learning Scrollbars.
[Updated on: Tue, 22 March 2011 00:53] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 29 00:29:40 CEST 2024
Total time taken to generate the page: 0.03298 seconds
|