/** * Animation step. */ public void updateAnimation() { preview = new mxCellStatePreview(graphComponent, false); if (cells != null) { // Animates the given cells individually without recursion for (Object cell : cells) { animateCell(cell, preview, false); } } else { // Animates all changed cells by using recursion to find // the changed cells but not for the animation itself Object root = graphComponent.getGraph().getModel().getRoot(); animateCell(root, preview, true); } show(preview); if (preview.isEmpty() || step++ >= steps) { stopAnimation(); } };
public void invoke(Object sender, mxEventObject evt) { Graphics g = (Graphics) evt.getProperty("g"); paint(g); } });
delta = getDelta(state); if (recurse && !stopRecursion(state, delta)) animateCell(graph.getModel().getChildAt(cell, i), move, recurse);
/** * Returns the top, left corner of the given cell. */ protected mxPoint getOriginForCell(Object cell) { mxPoint result = origins.get(cell); if (result == null) { mxGraph graph = graphComponent.getGraph(); if (cell != null) { result = new mxPoint(getOriginForCell(graph.getModel() .getParent(cell))); mxGeometry geo = graph.getCellGeometry(cell); // TODO: Handle offset, relative geometries etc if (geo != null) { result.setX(result.getX() + geo.getX()); result.setY(result.getY() + geo.getY()); } } if (result == null) { mxPoint t = graph.getView().getTranslate(); result = new mxPoint(-t.getX(), -t.getY()); } origins.put(cell, result); } return result; }
delta = getDelta(state); if (recurse && !stopRecursion(state, delta)) animateCell(graph.getModel().getChildAt(cell, i), move, recurse);
/** * Returns the top, left corner of the given cell. */ protected mxPoint getOriginForCell(Object cell) { mxPoint result = origins.get(cell); if (result == null) { mxGraph graph = graphComponent.getGraph(); if (cell != null) { result = new mxPoint(getOriginForCell(graph.getModel() .getParent(cell))); mxGeometry geo = graph.getCellGeometry(cell); // TODO: Handle offset, relative geometries etc if (geo != null) { result.setX(result.getX() + geo.getX()); result.setY(result.getY() + geo.getY()); } } if (result == null) { mxPoint t = graph.getView().getTranslate(); result = new mxPoint(-t.getX(), -t.getY()); } origins.put(cell, result); } return result; }
/** * Animation step. */ public void updateAnimation() { super.updateAnimation(); preview = new mxCellStatePreview(graphComponent, false); if (cells != null) { // Animates the given cells individually without recursion for (Object cell : cells) { animateCell(cell, preview, false); } } else { // Animates all changed cells by using recursion to find // the changed cells but not for the animation itself Object root = graphComponent.getGraph().getModel().getRoot(); animateCell(root, preview, true); } show(preview); if (preview.isEmpty() || step++ >= steps) { stopAnimation(); } };
/** * Returns the vector between the current rendered state and the future * location of the state after the display will be updated. */ protected mxPoint getDelta(mxCellState state) { mxGraph graph = graphComponent.getGraph(); mxPoint origin = getOriginForCell(state.getCell()); mxPoint translate = graph.getView().getTranslate(); double scale = graph.getView().getScale(); mxPoint current = new mxPoint(state.getX() / scale - translate.getX(), state.getY() / scale - translate.getY()); return new mxPoint((origin.getX() - current.getX()) * scale, (origin .getY() - current.getY()) * scale); }
public void invoke(Object sender, mxEventObject evt) { Graphics g = (Graphics) evt.getProperty("g"); paint(g); } });
/** * Returns the vector between the current rendered state and the future * location of the state after the display will be updated. */ protected mxPoint getDelta(mxCellState state) { mxGraph graph = graphComponent.getGraph(); mxPoint origin = getOriginForCell(state.getCell()); mxPoint translate = graph.getView().getTranslate(); double scale = graph.getView().getScale(); mxPoint current = new mxPoint(state.getX() / scale - translate.getX(), state.getY() / scale - translate.getY()); return new mxPoint((origin.getX() - current.getX()) * scale, (origin .getY() - current.getY()) * scale); }