Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "WorldCanvas 3" | |
132 | .TH WorldCanvas 3 "2002-11-19" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Tk::WorldCanvas \- Autoscaling Canvas widget with zoom, viewAll, viewArea, viewFit, and center. | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& $worldcanvas = $parent->WorldCanvas(?options?); | |
139 | .Ve | |
140 | .SH "DESCRIPTION" | |
141 | .IX Header "DESCRIPTION" | |
142 | This module is a wrapper around the Canvas widget that maps the | |
143 | user's coordinate system to the now mostly hidden coordinate system of | |
144 | the Canvas widget. In world coordinates the y\-axis increases in | |
145 | the upward direction. | |
146 | .PP | |
147 | \&\fIWorldCanvas\fR is meant to be a replacement for Canvas. It's not | |
148 | quite a \*(L"drop in\*(R" replacement though because the y\-axis is inverted | |
149 | compared to Canvas. Usually to convert you will have to invert all | |
150 | y\-coordinates used to create objects. Typically, you should call | |
151 | \&\f(CW$worldcanvas\fR\->viewAll (or \f(CW$worldcanvas\fR\->viewArea(@box)) before calling | |
152 | MainLoop. | |
153 | .PP | |
154 | Most of the \fIWorldCanvas\fR methods are the same as the \fICanvas\fR | |
155 | methods except that they accept and return world coordinates instead | |
156 | of widget coordinates. | |
157 | .SH "INSTALLATION" | |
158 | .IX Header "INSTALLATION" | |
159 | .Vb 1 | |
160 | \& Standard method: | |
161 | .Ve | |
162 | .PP | |
163 | .Vb 4 | |
164 | \& perl Makefile.PL | |
165 | \& make | |
166 | \& make test | |
167 | \& make install | |
168 | .Ve | |
169 | .PP | |
170 | .Vb 1 | |
171 | \& The last step requires proper permissions. | |
172 | .Ve | |
173 | .PP | |
174 | .Vb 2 | |
175 | \& Or you can copy the WorldCanvas.pm file to a local directory and | |
176 | \& skip the formalities. | |
177 | .Ve | |
178 | .SH "NEW METHODS" | |
179 | .IX Header "NEW METHODS" | |
180 | .IP "\fI$worldcanvas\fR\->\fBzoom\fR(\fIzoom factor\fR)" 4 | |
181 | .IX Item "$worldcanvas->zoom(zoom factor)" | |
182 | Zooms the display by the specified amount. Example: | |
183 | .Sp | |
184 | .Vb 2 | |
185 | \& $worldcanvas->CanvasBind('<i>' => sub {$worldcanvas->zoom(1.25)}); | |
186 | \& $worldcanvas->CanvasBind('<o>' => sub {$worldcanvas->zoom(0.8)}); | |
187 | .Ve | |
188 | .Sp | |
189 | .Vb 6 | |
190 | \& # If you are using the 'Scrolled' constructor as in: | |
191 | \& my $worldcanvas = $main->Scrolled('WorldCanvas', -scrollbars => 'nw', ... ) | |
192 | \& # you want to bind the key-presses to the 'worldcanvas' Subwidget of Scrolled. | |
193 | \& my $scrolled_canvas = $worldcanvas->Subwidget('worldcanvas'); # note the lower case 'worldcanvas' | |
194 | \& $scrolled_canvas->CanvasBind('<i>' => sub {$scrolled_canvas->zoom(1.25)}); | |
195 | \& $scrolled_canvas->CanvasBind('<o>' => sub {$scrolled_canvas->zoom(0.8)}); | |
196 | .Ve | |
197 | .Sp | |
198 | .Vb 4 | |
199 | \& # I don't like the scrollbars taking the focus when I | |
200 | \& # <ctrl>-tab through the windows, so I: | |
201 | \& $worldcanvas->Subwidget('xscrollbar')->configure(-takefocus => 0); | |
202 | \& $worldcanvas->Subwidget('yscrollbar')->configure(-takefocus => 0); | |
203 | .Ve | |
204 | .IP "\fI$worldcanvas\fR\->\fBcenter\fR(\fIx, y\fR)" 4 | |
205 | .IX Item "$worldcanvas->center(x, y)" | |
206 | Centers the display around world coordinates x, y. | |
207 | Example: | |
208 | .Sp | |
209 | .Vb 6 | |
210 | \& $worldcanvas->CanvasBind('<2>' => | |
211 | \& sub { | |
212 | \& $worldcanvas->CanvasFocus; | |
213 | \& $worldcanvas->center($worldcanvas->eventLocation); | |
214 | \& } | |
215 | \& ); | |
216 | .Ve | |
217 | .IP "\fI$worldcanvas\fR\->\fBcenterTags\fR([\-exact => {0 | 1}], \fITagOrID, [TagOrID, ...]\fR)" 4 | |
218 | .IX Item "$worldcanvas->centerTags([-exact => {0 | 1}], TagOrID, [TagOrID, ...])" | |
219 | Centers the display around the center of the bounding box | |
220 | containing the specified TagOrID's without changing the current | |
221 | magnification of the display. | |
222 | .Sp | |
223 | \&'\-exact => 1' will cause the canvas to be scaled twice to get | |
224 | an accurate bounding box. This will be expensive if the canvas | |
225 | contains a large number of objects. | |
226 | .IP "\fI$worldcanvas\fR\->\fBeventLocation\fR()" 4 | |
227 | .IX Item "$worldcanvas->eventLocation()" | |
228 | Returns the world coordinates (x, y) of the last Xevent. | |
229 | .IP "\fI$worldcanvas\fR\->\fBpanWorld\fR(\fIdx, dy\fR)" 4 | |
230 | .IX Item "$worldcanvas->panWorld(dx, dy)" | |
231 | Pans the display by the specified world distances. \fBpanWorld\fR | |
232 | is not meant to replace the xview/yview panning methods. Most | |
233 | user interfaces will want the arrow keys tied to the xview/yview | |
234 | panning methods (the default bindings), which pan in widget | |
235 | coordinates. | |
236 | .Sp | |
237 | If you do want to change the arrow key-bindings to pan in world | |
238 | coordinates using \fBpanWorld\fR you must disable the default arrow | |
239 | key\-bindings. | |
240 | .Sp | |
241 | .Vb 1 | |
242 | \& Example: | |
243 | .Ve | |
244 | .Sp | |
245 | .Vb 4 | |
246 | \& $mainwindow->bind('WorldCanvas', '<Up>' => ""); | |
247 | \& $mainwindow->bind('WorldCanvas', '<Down>' => ""); | |
248 | \& $mainwindow->bind('WorldCanvas', '<Left>' => ""); | |
249 | \& $mainwindow->bind('WorldCanvas', '<Right>' => ""); | |
250 | .Ve | |
251 | .Sp | |
252 | .Vb 4 | |
253 | \& $worldcanvas->CanvasBind( '<Up>' => sub {$worldcanvas->panWorld(0, 100);}); | |
254 | \& $worldcanvas->CanvasBind( '<Down>' => sub {$worldcanvas->panWorld(0, -100);}); | |
255 | \& $worldcanvas->CanvasBind( '<Left>' => sub {$worldcanvas->panWorld(-100, 0);}); | |
256 | \& $worldcanvas->CanvasBind('<Right>' => sub {$worldcanvas->panWorld( 100, 0);}); | |
257 | .Ve | |
258 | .Sp | |
259 | This is not usually desired, as the percentage of the display that | |
260 | is shifted will be dependent on the current display magnification. | |
261 | .IP "\fI$worldcanvas\fR\->\fBpixelSize\fR()" 4 | |
262 | .IX Item "$worldcanvas->pixelSize()" | |
263 | Returns the width (in world coordinates) of a pixel (at the current magnification). | |
264 | .IP "\fI$worldcanvas\fR\->\fBrubberBand\fR(\fI{0|1|2}\fR)" 4 | |
265 | .IX Item "$worldcanvas->rubberBand({0|1|2})" | |
266 | Creates a rubber banding box that allows the user to graphically | |
267 | select a region. \fBrubberBand\fR is called with a step parameter | |
268 | \&'0', '1', or '2'. '0' to start a new box, '1' to stretch the box, | |
269 | and '2' to finish the box. When called with '2', the specified | |
270 | box is returned (x1, y1, x2, y2) | |
271 | .Sp | |
272 | The band color is set with the \fIWorldCanvas\fR option '\-bandColor'. | |
273 | The default color is 'red' | |
274 | .Sp | |
275 | Example, specify a region to delete: | |
276 | .Sp | |
277 | .Vb 11 | |
278 | \& $worldcanvas->configure(-bandColor => 'purple'); | |
279 | \& $worldcanvas->CanvasBind('<3>' => sub {$worldcanvas->CanvasFocus; | |
280 | \& $worldcanvas->rubberBand(0) | |
281 | \& }); | |
282 | \& $worldcanvas->CanvasBind('<B3-Motion>' => sub {$worldcanvas->rubberBand(1)}); | |
283 | \& $worldcanvas->CanvasBind('<ButtonRelease-3>' => sub {my @box = $worldcanvas->rubberBand(2); | |
284 | \& my @ids = $worldcanvas->find('enclosed', @box); | |
285 | \& foreach my $id (@ids) {$worldcanvas->delete($id)} | |
286 | \& }); | |
287 | \& # Note: '<B3-ButtonRelease>' will be called for any ButtonRelease! | |
288 | \& # You should use '<ButtonRelease-3>' instead. | |
289 | .Ve | |
290 | .Sp | |
291 | .Vb 2 | |
292 | \& # If you want the rubber band to look smooth during panning and | |
293 | \& # zooming, add rubberBand(1) update calls to the appropriate key-bindings: | |
294 | .Ve | |
295 | .Sp | |
296 | .Vb 6 | |
297 | \& $worldcanvas->CanvasBind( '<Up>' => sub {$worldcanvas->rubberBand(1);}); | |
298 | \& $worldcanvas->CanvasBind( '<Down>' => sub {$worldcanvas->rubberBand(1);}); | |
299 | \& $worldcanvas->CanvasBind( '<Left>' => sub {$worldcanvas->rubberBand(1);}); | |
300 | \& $worldcanvas->CanvasBind('<Right>' => sub {$worldcanvas->rubberBand(1);}); | |
301 | \& $worldcanvas->CanvasBind('<i>' => sub {$worldcanvas->zoom(1.25); $worldcanvas->rubberBand(1);}); | |
302 | \& $worldcanvas->CanvasBind('<o>' => sub {$worldcanvas->zoom(0.8); $worldcanvas->rubberBand(1);}); | |
303 | .Ve | |
304 | .Sp | |
305 | This box avoids the overhead of bounding box calculations | |
306 | that can occur if you create your own rubberBand outside of \fIWorldCanvas\fR. | |
307 | .IP "\fI$worldcanvas\fR\->\fBviewAll\fR([\-border => number])" 4 | |
308 | .IX Item "$worldcanvas->viewAll([-border => number])" | |
309 | Displays at maximum possible zoom all objects centered in the | |
310 | \&\fIWorldCanvas\fR. The switch '\-border' specifies, as a percentage | |
311 | of the screen, the minimum amount of white space to be left on | |
312 | the edges of the display. Default '\-border' is 0.02. | |
313 | .IP "\fI$worldcanvas\fR\->\fBviewArea\fR(x1, y1, x2, y2, [\-border => number]))" 4 | |
314 | .IX Item "$worldcanvas->viewArea(x1, y1, x2, y2, [-border => number]))" | |
315 | Displays at maximum possible zoom the specified region centered | |
316 | in the \fIWorldCanvas\fR. | |
317 | .IP "\fI$worldcanvas\fR\->\fBviewFit\fR([\-border => number], \fITagOrID\fR, [\fITagOrID\fR, ...])" 4 | |
318 | .IX Item "$worldcanvas->viewFit([-border => number], TagOrID, [TagOrID, ...])" | |
319 | Adjusts the worldcanvas to display all of the specified tags. The '\-border' | |
320 | switch specifies (as a percentage) how much extra surrounding space should be shown. | |
321 | .IP "\fI$worldcanvas\fR\->\fBgetView\fR()" 4 | |
322 | .IX Item "$worldcanvas->getView()" | |
323 | Returns the rectangle of the current view (x1, y1, x2, y2) | |
324 | .IP "\fI$worldcanvas\fR\->\fBwidgetx\fR(\fIx\fR)" 4 | |
325 | .IX Item "$worldcanvas->widgetx(x)" | |
326 | .PD 0 | |
327 | .IP "\fI$worldcanvas\fR\->\fBwidgety\fR(\fIy\fR)" 4 | |
328 | .IX Item "$worldcanvas->widgety(y)" | |
329 | .IP "\fI$worldcanvas\fR\->\fBwidgetxy\fR(\fIx, y\fR)" 4 | |
330 | .IX Item "$worldcanvas->widgetxy(x, y)" | |
331 | .PD | |
332 | Convert world coordinates to widget coordinates. | |
333 | .IP "\fI$worldcanvas\fR\->\fBworldx\fR(\fIx\fR)" 4 | |
334 | .IX Item "$worldcanvas->worldx(x)" | |
335 | .PD 0 | |
336 | .IP "\fI$worldcanvas\fR\->\fBworldy\fR(\fIy\fR)" 4 | |
337 | .IX Item "$worldcanvas->worldy(y)" | |
338 | .IP "\fI$worldcanvas\fR\->\fBworldxy\fR(\fIx, y\fR)" 4 | |
339 | .IX Item "$worldcanvas->worldxy(x, y)" | |
340 | .PD | |
341 | Convert widget coordinates to world coordinates. | |
342 | .SH "CHANGED METHODS" | |
343 | .IX Header "CHANGED METHODS" | |
344 | .RS 4 | |
345 | World coordinates are supplied and returned to \fBWorldCanvas\fR methods | |
346 | instead of widget coordinates unless otherwise specified. (ie. These | |
347 | methods take and return world coordinates: center, panWorld, viewArea, | |
348 | find, coords, scale, move, bbox, rubberBand, eventLocation, pixelSize, | |
349 | and create*) | |
350 | .RE | |
351 | .IP "\fI$worldcanvas\fR\->\fBbbox\fR([\-exact => {0 | 1}], \fITagOrID\fR, [\fITagOrID\fR, ...])" 4 | |
352 | .IX Item "$worldcanvas->bbox([-exact => {0 | 1}], TagOrID, [TagOrID, ...])" | |
353 | \&'\-exact => 1' is only needed if the TagOrID is not 'all'. It | |
354 | will cause the canvas to be scaled twice to get an accurate | |
355 | bounding box. This will be expensive if the canvas contains | |
356 | a large number of objects. | |
357 | .Sp | |
358 | Neither setting of exact will produce exact results because | |
359 | the underlying canvas bbox method returns a slightly larger box | |
360 | to insure that everything is contained. It appears that a number | |
361 | close to '2' is added or subtracted. The '\-exact => 1' zooms | |
362 | in to reduce this error. | |
363 | .Sp | |
364 | If the underlying canvas \fBbbox\fR method returns a bounding box | |
365 | that is small (high error percentage) then '\-exact => 1' is done | |
366 | automatically. | |
367 | .IP "\fI$worldcanvas\fR\->\fBscale\fR(\fI'all', xOrigin, yOrigin, xScale, yScale\fR)" 4 | |
368 | .IX Item "$worldcanvas->scale('all', xOrigin, yOrigin, xScale, yScale)" | |
369 | \&\fBScale\fR should not be used to 'zoom' the display in and out as it will | |
370 | change the world coordinates of the scaled objects. Methods \fBzoom\fR, | |
371 | \&\fBviewArea\fR, and \fBviewAll\fR should be used to change the | |
372 | scale of the display without affecting the dimensions of the objects. | |
373 | .SH "VIEW AREA CHANGE CALLBACK" | |
374 | .IX Header "VIEW AREA CHANGE CALLBACK" | |
375 | \&\fITk::WorldCanvas\fR option '\-changeView' can be used to specify | |
376 | a callback for a change of the view area. This is useful for | |
377 | updating a second worldcanvas which is displaying the view region | |
378 | of the first worldcanvas. | |
379 | .PP | |
380 | The callback subroutine will be passed the coordinates of the | |
381 | displayed box (x1, y1, x2, y2). These arguments are added after | |
382 | any extra arguments specifed by the user calling 'configure'. | |
383 | .PP | |
384 | .Vb 1 | |
385 | \& Example: | |
386 | .Ve | |
387 | .PP | |
388 | .Vb 3 | |
389 | \& $worldcanvas->configure(-changeView => [\e&changeView, $worldcanvas2]); | |
390 | \& # viewAll if worldcanvas2 widget is resized. | |
391 | \& $worldcanvas2->CanvasBind('<Configure>' => sub {$worldcanvas2->viewAll}); | |
392 | .Ve | |
393 | .PP | |
394 | .Vb 4 | |
395 | \& { | |
396 | \& my $viewBox; | |
397 | \& sub changeView { | |
398 | \& my ($canvas2, @coords) = @_; | |
399 | .Ve | |
400 | .PP | |
401 | .Vb 4 | |
402 | \& $canvas2->delete($viewBox) if $viewBox; | |
403 | \& $viewBox = $canvas2->createRectangle(@coords, -outline => 'orange'); | |
404 | \& } | |
405 | \& } | |
406 | .Ve | |
407 | .SH "SCROLL REGION NOTES" | |
408 | .IX Header "SCROLL REGION NOTES" | |
409 | (1) The underlying \fITk::Canvas\fR has a '\-confine' option which is set | |
410 | to '1' by default. With '\-confine => 1' the canvas will not allow | |
411 | the display to go outside of the scroll region causing some methods | |
412 | to not work accurately. For example, the 'center' method will not be | |
413 | able to center on coordinates near to the edge of the scroll region; | |
414 | \&'zoom out' near the edge will zoom out and pan towards the center. | |
415 | .PP | |
416 | \&\fITk::WorldCanvas\fR sets '\-confine => 0' by default to avoid these | |
417 | problems. You can change it back with: | |
418 | .PP | |
419 | .Vb 1 | |
420 | \& $worldcanvas->configure(-confine => 1); | |
421 | .Ve | |
422 | .PP | |
423 | (2) '\-scrollregion' is maintained by \fIWorldCanvas\fR to include all | |
424 | objects on the canvas. '\-scrollregion' will be adjusted automatically | |
425 | as objects are added, deleted, scaled, moved, etc. (You can create a | |
426 | static scrollregion by adding a border rectangle to the canvas.) | |
427 | .PP | |
428 | (3) The bounding box of all objects is required to set the scroll region. | |
429 | Calculating this bounding box is expensive if the canvas has a large | |
430 | number of objects. So for performance reasons these operations will | |
431 | not immediately change the bounding box if they potentially shrink it: | |
432 | .PP | |
433 | .Vb 4 | |
434 | \& coords | |
435 | \& delete | |
436 | \& move | |
437 | \& scale | |
438 | .Ve | |
439 | .PP | |
440 | Instead they will mark the bounding box as invalid, and it will be | |
441 | updated at the next zoom or pan operation. The only downside to this | |
442 | is that the scrollbars will be incorrect until the update. | |
443 | .PP | |
444 | If these operations increase the size of the box, changing the box is | |
445 | trivial and the update is immediate. | |
446 | .SH "AUTHOR" | |
447 | .IX Header "AUTHOR" | |
448 | Joseph Skrovan (\fIjoseph@skrovan.com\fR) | |
449 | .PP | |
450 | Note: based on an earlier implementation by Rudy Albachten (\fIrudy@albachten.com\fR) | |
451 | .PP | |
452 | If you use and enjoy \fIWorldCanvas\fR please let me know. | |
453 | .SH "COPYRIGHTS" | |
454 | .IX Header "COPYRIGHTS" | |
455 | .Vb 3 | |
456 | \& Copyright (c) 2002 Joseph Skrovan. All rights reserved. | |
457 | \& This program is free software; you can redistribute it and/or modify it | |
458 | \& under the same terms as Perl itself. | |
459 | .Ve |