use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.
the class ChangeShiftYActor method setShiftY.
private void setShiftY(final NodeModel node, final Quantity<LengthUnits> shiftY) {
final LocationModel locationModel = LocationModel.createLocationModel(node);
locationModel.setShiftY(shiftY);
Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.
the class ChangeShiftXActor method setShiftX.
private void setShiftX(final NodeModel node, final int hGap) {
final LocationModel locationModel = LocationModel.createLocationModel(node);
locationModel.setHGap(hGap);
Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.
the class MNodeMotionListener method resetPositions.
/**
*/
private void resetPositions(final NodeModel node) {
final LocationModel locationModel = LocationModel.getModel(node.getParentNode());
locationModel.setVGap(originalParentVGap);
LocationModel.getModel(node).setHGap(originalHGap);
LocationModel.getModel(node).setShiftY(originalShiftY);
}
use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.
the class MNodeMotionListener method mouseDragged.
@Override
public void mouseDragged(final MouseEvent e) {
if (!isDragActive())
return;
if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == (InputEvent.BUTTON1_DOWN_MASK)) {
final MainView mainView = (MainView) e.getSource();
final NodeView nodeV = getNodeView(e);
final MapView mapView = nodeV.getMap();
final Point point = e.getPoint();
findGridPoint(point);
UITools.convertPointToAncestor(nodeV, point, JScrollPane.class);
ModeController c = Controller.getCurrentController().getModeController();
final Point dragNextPoint = point;
if (!Compat.isCtrlEvent(e)) {
final NodeModel node = nodeV.getModel();
final LocationModel locationModel = LocationModel.createLocationModel(node);
final int hGapChange = getHGapChange(dragNextPoint, node);
if (hGapChange != 0) {
locationModel.setHGap(originalHGap + hGapChange);
}
final int shiftYChange = getNodeShiftYChange(dragNextPoint, node);
if (shiftYChange != 0) {
locationModel.setShiftY(originalShiftY + shiftYChange);
}
if (hGapChange != 0 || shiftYChange != 0)
c.getMapController().nodeRefresh(node);
else
return;
} else {
final NodeModel parentNode = nodeV.getVisibleParentView().getModel();
final int vGapChange = getVGapChange(dragNextPoint, parentNode);
if (vGapChange != 0) {
LocationModel.createLocationModel(parentNode).setVGap(Math.max(0, originalParentVGap - vGapChange));
final MapController mapController = c.getMapController();
mapController.nodeRefresh(parentNode);
mapController.nodeRefresh(nodeV.getModel());
} else
return;
}
EventQueue.invokeLater(new Runnable() {
public void run() {
final Rectangle r = mainView.getBounds();
UITools.convertRectangleToAncestor(mainView.getParent(), r, mapView);
final boolean isEventPointVisible = mapView.getVisibleRect().contains(r);
if (!isEventPointVisible) {
mapView.scrollRectToVisible(r);
}
}
});
}
}
use of org.freeplane.features.nodelocation.LocationModel in project freeplane by freeplane.
the class ChangeShiftXActor method setShiftX.
private void setShiftX(final NodeModel node, final Quantity<LengthUnits> hGap) {
final LocationModel locationModel = LocationModel.createLocationModel(node);
locationModel.setHGap(hGap);
Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
Aggregations