if (pageDefinition == null)
{
return;
}
final LinealModel linealModel = getLinealModel();
if (draggedGuideLineIndex == -1 || ((linealModel.getGuideLineCount() - 1) < draggedGuideLineIndex))
{
return;
}
if (draggedGuideLineIndex != getActiveGuideLineIndex())
{
setActiveGuideLineIndex(draggedGuideLineIndex);
}
final GuideLine dragged = linealModel.getGuideLine(draggedGuideLineIndex);
double start = 0;
if (isShowLeftBorder())
{
start = getLeftBorder();
}
final double width = pageDefinition.getWidth();
final float scaleFactor = getZoomAsMicropoints();
final double scaledPosition = (e.getX() / scaleFactor) - start;
final double position = Math.min(width, Math.max((double) 0, scaledPosition));
final GuideLine newGuideLine = new GuideLine(position, dragged.isActive());
final UndoManager undo = getRenderContext().getUndo();
undo.addChange(Messages.getString("LinealComponent.ChangeGuideUndoName"),
new UpdateHorizontalGuidelineUndoEntry(draggedGuideLineIndex, newGuideLine, dragged));
linealModel.updateGuideLine(draggedGuideLineIndex, newGuideLine);
}