/* * This is where we decide how to change the figure. Either we pass to * super.updateScene to modify the picked bone or we activate mouseRotate to * modify the selected bone. */ @Override public void updateScene(int x, int y) { if (canvas != mevent.getComponent() || !enabled) return; if (keyFramePanel == null || !keyFramePanel.isUseSelected()) { super.updateScene(x, y); return; } final int boneIndex = keyFramePanel.getSelectedBone(); if (boneIndex >= 0) { final TransformGroup tg = figure.get(boneIndex).getTransformGroup(Bone.ROTATION_TG); mouseRotate.setTransformGroup(tg); mouseRotate.wakeup(); } }
public CustomPickRotateBehavior( Figure figure, Canvas3D canvas, Bounds bounds, FigureUniverse universe) { super(figure, canvas, bounds, PickInfo.PICK_GEOMETRY); if (universe == null) throw new IllegalArgumentException( "Cannot have a null universe for a CustomPickRotateBehavior"); this.canvas = canvas; this.universe = universe; this.figure = figure; mouseRotate = new MouseRotate(MouseRotate.MANUAL_WAKEUP); mouseRotate.setTransformGroup(currGrp); mouseRotate.setSchedulingBounds( new javax.media.j3d.BoundingSphere(new javax.vecmath.Point3d(0, 0, 0), 10)); figure.addChild(mouseRotate); }