job->pageOffset.x = - job->pageSize.x * pagesArrayElem.x;
job->pageOffset.y = - job->pageSize.y * pagesArrayElem.y;
#endif
- job->clip.LL.x = job->focus.x + job->pageSize.x * (pagesArrayElem.x - pagesArraySize.x / 2.);
- job->clip.LL.y = job->focus.y + job->pageSize.y * (pagesArrayElem.y - pagesArraySize.y / 2.) - 1;
- job->clip.UR.x = job->clip.LL.x + job->pageSize.x + 1;
- job->clip.UR.y = job->clip.LL.y + job->pageSize.y + 1;
+
+ if (job->flags & GVDEVICE_EVENTS) {
+ job->clip.LL.x = job->focus.x - job->view.x / 2.;
+ job->clip.LL.y = job->focus.y - job->view.y / 2.;
+ job->clip.UR.x = job->focus.x + job->view.x / 2.;
+ job->clip.UR.y = job->focus.y + job->view.y / 2.;
+ }
+ else {
+ job->clip.LL.x = job->focus.x + job->pageSize.x * (pagesArrayElem.x - pagesArraySize.x / 2.);
+ job->clip.LL.y = job->focus.y + job->pageSize.y * (pagesArrayElem.y - pagesArraySize.y / 2.) - 1;
+ job->clip.UR.x = job->clip.LL.x + job->pageSize.x + 1;
+ job->clip.UR.y = job->clip.LL.y + job->pageSize.y + 1;
+ }
/* CAUTION - job->translation was difficult to get right. */
/* Test with and without assymetric margins, e.g: -Gmargin="1,0" */
/* compute current view in graph units */
if (job->rotation) {
- job->view.y = job->width / job->scale.x;
- job->view.x = job->height / job->scale.y;
+ job->view.y = job->width / job->scale.y;
+ job->view.x = job->height / job->scale.x;
}
else {
job->view.x = job->width / job->scale.x;
job->view.y = job->height / job->scale.y;
}
+#if 0
+fprintf(stderr,"focus=%g,%g view=%g,%g\n",
+ job->focus.x, job->focus.y, job->view.x, job->view.y);
+#endif
s = late_string(g, agfindattr(g, "comment"), "");
gvrender_comment(job, s);
/* FIXME - should code window 0,0 point as feature with Y_GOES_DOWN */
job->fit_mode = 0;
if (job->rotation) {
- job->focus.x -= (pointer.y - job->height)
+ job->focus.x -= (pointer.y - job->height / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.y);
- job->focus.y += (pointer.x)
+ job->focus.y += (pointer.x - job->width / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.x);
}
else {
- job->focus.x += (pointer.x)
+ job->focus.x += (pointer.x - job->width / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.x);
- job->focus.y += (pointer.y - job->height)
+ job->focus.y += (pointer.y - job->height / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.y);
}
job->zoom *= ZOOMFACTOR;
job->fit_mode = 0;
job->zoom /= ZOOMFACTOR;
if (job->rotation) {
- job->focus.x += (pointer.y - job->height)
+ job->focus.x += (pointer.y - job->height / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.y);
- job->focus.y -= (pointer.x)
+ job->focus.y -= (pointer.x - job->width / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.x);
}
else {
- job->focus.x -= (pointer.x)
+ job->focus.x -= (pointer.x - job->width / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.x);
- job->focus.y -= (pointer.y - job->height)
+ job->focus.y -= (pointer.y - job->height / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.y);
}
job->needs_refresh = 1;