/** * Schedule the given activity with the root, note that only scheduled * activities will be stepped. If the activity is successfully added true is * returned, else false. * * @param activity new activity to schedule * @return true if the activity is successfully scheduled. */ public boolean addActivity(final PActivity activity) { final PRoot r = getRoot(); if (r != null) { return r.addActivity(activity); } return false; }
/** * Schedules the "infinite" drag activity so that auto-panning and zooming * will continue to update the scene even if there are no further drag * events fired. For example, if the mouse is dragged to the right while * pressing the right mouse button and then paused for a while, the scene * should continue to zoom in. * * @param event the event that's responsible for the start of the activity */ protected void startDragActivity(final PInputEvent event) { dragActivity = new PActivity(-1, PUtil.DEFAULT_ACTIVITY_STEP_RATE); dragActivity.setDelegate(new PActivity.PActivityDelegate() { public void activityStarted(final PActivity activity) { dragActivityFirstStep(dragEvent); } public void activityStepped(final PActivity activity) { dragActivityStep(dragEvent); } public void activityFinished(final PActivity activity) { dragActivityFinalStep(dragEvent); } }); event.getCamera().getRoot().addActivity(dragActivity); }