public void setScale(double newscale, boolean animated, int duration) { if (!animated) { Point center = getCenterCoord(); this.scale = newscale; scrollTo(center); updateLOD(); } else { PropertyAnimation ani = new PropertyAnimation(this, "scale"); ani.setStartNumber(this.scale); ani.setEndNumber(newscale); ani.setDuration(duration); ani.start(); } }
public void scrollTo(int x, int z, boolean animated, int duration) { if (!animated) { Point p = mapCoordsToOutside(new Point(x, z)); int scrollX = p.getX(), scrollZ = p.getY(); setScrollPosition(Orientation.HORIZONTAL, scrollX - (int) (getWidth() / 2)); setScrollPosition(Orientation.VERTICAL, scrollZ - (int) (getHeight() / 2)); } else { Point start = getCenterCoord(); Point end = new Point(x, z); PropertyAnimation ani = new PropertyAnimation(this, "scrollpos"); ani.setStartValue(start); ani.setEndValue(end); ani.setDuration(duration); ani.start(); } }