void rotate(final int xNew, final int yNew) { if (content == null || content.isLocked()) return; final int dx = xNew - xLast; final int dy = yNew - yLast; aaX.set(axisPerDx, dx * anglePerPix); aaY.set(axisPerDy, dy * anglePerPix); transX.set(aaX); transY.set(aaY); rotateTG.getTransform(rotateOld); rotateNew.set(transl_inv); rotateNew.mul(transY); rotateNew.mul(transX); rotateNew.mul(transl); rotateNew.mul(rotateOld); rotateTG.setTransform(rotateNew); xLast = xNew; yLast = yNew; transformChanged(BehaviorCallback.ROTATE, rotateNew); }
void translate(final int xNew, final int yNew) { if (content == null || content.isLocked()) return; final int dx = xNew - xLast; final int dy = yNew - yLast; translateTG.getTransform(translateOld); v1.scale(dx, translationPerDx); v2.scale(-dy, translationPerDy); translation.add(v1, v2); translateNew.set(translation); translateNew.mul(translateOld); translateTG.setTransform(translateNew); transformChanged(BehaviorCallback.TRANSLATE, translateNew); xLast = xNew; yLast = yNew; }