2380 |
* @param center |
* @param center |
2381 |
* position in window coordinates |
* position in window coordinates |
2382 |
* @param zoomFaktor |
* @param zoomFaktor |
2383 |
* > 1 for zoom in, < 1 for zoom out. Default is 1.33. |
* > 1 for zoom out, < 1 for zoom in. Default is .5 |
2384 |
*/ |
*/ |
2385 |
public void zoomTo(Point center, Double zoomFaktor) { |
public void zoomTo(Point center, Double zoomFaktor) { |
2386 |
if (zoomFaktor == null || zoomFaktor == 0.) |
if (zoomFaktor == null || zoomFaktor == 0.) |
2387 |
zoomFaktor = 2.; |
zoomFaktor = .5; |
2388 |
|
|
2389 |
final Point2D gcenter = getScreenToWorld().transform(center, null); |
final Point2D gcenter = getScreenToWorld().transform(center, null); |
2390 |
center = null; |
center = null; |
2406 |
.getHeight()) / 2.); |
.getHeight()) / 2.); |
2407 |
|
|
2408 |
// // Move the newMapArea above the new center if we zoom in: |
// // Move the newMapArea above the new center if we zoom in: |
2409 |
if (zoomFaktor >= 1) { |
newMapArea.translate(gcenter.getX() - mapArea.centre().x, gcenter |
2410 |
newMapArea.translate(gcenter.getX() - mapArea.centre().x, gcenter |
.getY() |
2411 |
.getY() |
- mapArea.centre().y); |
|
- mapArea.centre().y); |
|
|
} |
|
2412 |
|
|
2413 |
setMapArea(newMapArea); |
setMapArea(newMapArea); |
2414 |
} |
} |