Discussion:
zooming and scrolling
Ludovic Aubert
2014-04-07 21:47:01 UTC
Permalink
Subject: zooming and scrolling
To: wx-***@googlegroups.com


Using wxScrolledWindow, I would like to programmatically scroll to a given
position, in a zoomed view.
If the scale = 1, no problem, the call to wxScrolledWindow::Scroll(x,y),
where x and y are two logical coordinates (independant of the zoom scale)
works just fine, and the view is scrolled to where I want it to be.
But if the scale != 1, the call takes it to a wrong location. I can't
figure out why.
A prior call to GetScrollPixelsPerUnit() returns 1 for both axis.

Some code to illustrate how the zoom is implemented:

void MyScrolledWindow::OnDraw(wxDC& dc)
{
int x_start, y_start ;
this->GetViewStart(&x_start, &y_start) ;
dc.SetUserScale(scale, scale) ;
dc.SetDeviceOrigin(x_start, y_start) ;
draw_widgets(widgets, dc);//call to dc functions, in logical
coordinates...
}

Any help is appretiated
Thanks in advance
Ludovic
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Igor Korot
2014-04-10 05:02:33 UTC
Permalink
Hi,
Post by Ludovic Aubert
Subject: zooming and scrolling
Using wxScrolledWindow, I would like to programmatically scroll to a given
position, in a zoomed view.
If the scale = 1, no problem, the call to wxScrolledWindow::Scroll(x,y),
where x and y are two logical coordinates (independant of the zoom scale)
works just fine, and the view is scrolled to where I want it to be.
But if the scale != 1, the call takes it to a wrong location. I can't figure
out why.
A prior call to GetScrollPixelsPerUnit() returns 1 for both axis.
Did you try to reproduce it in a sample?
Also some basic questions: what is you OS and compiler? What version
of underlying toolkit you used
(if any)? Did you cross-compile?
What is your wx version?
Did you use any non-standard configuration options when building the library?
How did you build you application? I.e. did you change configuration
from building the library?
If you can reproduce the issue in a sample, please post a _really_
minimal patch to it with
an instructions on how it can be reproduced.

Thank you.
Post by Ludovic Aubert
void MyScrolledWindow::OnDraw(wxDC& dc)
{
int x_start, y_start ;
this->GetViewStart(&x_start, &y_start) ;
dc.SetUserScale(scale, scale) ;
dc.SetDeviceOrigin(x_start, y_start) ;
draw_widgets(widgets, dc);//call to dc functions, in logical
coordinates...
}
Any help is appretiated
Thanks in advance
Ludovic
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
or visit http://groups.google.com/group/wx-users
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Continue reading on narkive:
Loading...