mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
always show control point when creating new component
changed board alignment fixed sticking to non-stickable points
This commit is contained in:
Binary file not shown.
+9
-22
@@ -39,7 +39,6 @@ import org.diylc.common.IComponentFiler;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
@@ -425,9 +424,7 @@ public class Presenter implements IPlugInPort {
|
||||
public void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
||||
Map<IDIYComponent<?>, Set<Integer>> components = new HashMap<IDIYComponent<?>, Set<Integer>>();
|
||||
Point scaledPoint = scalePoint(point);
|
||||
if (componentSlot != null
|
||||
&& (componentSlot.getCreationMethod() == CreationMethod.POINT_BY_POINT || !componentSlot
|
||||
.isStretchable())) {
|
||||
if (componentSlot != null) {
|
||||
potentialControlPoint = scaledPoint;
|
||||
snapPointToGrid(potentialControlPoint);
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
@@ -586,12 +583,14 @@ public class Presenter implements IPlugInPort {
|
||||
}
|
||||
for (Integer j : entry.getValue()) {
|
||||
Point firstPoint = component.getControlPoint(i);
|
||||
Point secondPoint = entry.getKey().getControlPoint(j);
|
||||
// If they are close enough we can consider them
|
||||
// matched.
|
||||
if (firstPoint.distance(secondPoint) < ProjectPainter.CONTROL_POINT_SIZE) {
|
||||
componentMatches = true;
|
||||
break;
|
||||
if (entry.getKey().isControlPointSticky(j)) {
|
||||
Point secondPoint = entry.getKey().getControlPoint(j);
|
||||
// If they are close enough we can consider them
|
||||
// matched.
|
||||
if (firstPoint.distance(secondPoint) < ProjectPainter.CONTROL_POINT_SIZE) {
|
||||
componentMatches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1149,16 +1148,4 @@ public class Presenter implements IPlugInPort {
|
||||
return point == null ? null : new Point((int) (point.x / zoomLevel),
|
||||
(int) (point.y / zoomLevel));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param component
|
||||
* @return true if control points should be rendered for the specified
|
||||
* component.
|
||||
*/
|
||||
private boolean shouldShowControlPointsFor(IDIYComponent<?> component) {
|
||||
if (findAllGroupedComponents(component).size() > 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -26,9 +26,8 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
public static Size DEFAULT_HEIGHT = new Size(1d, SizeUnit.in);
|
||||
|
||||
protected String value;
|
||||
protected Point[] controlPoints = new Point[] {
|
||||
new Point(-DEFAULT_WIDTH.convertToPixels() / 2, -DEFAULT_HEIGHT.convertToPixels() / 2),
|
||||
new Point(DEFAULT_WIDTH.convertToPixels() / 2, DEFAULT_HEIGHT.convertToPixels() / 2) };
|
||||
protected Point[] controlPoints = new Point[] { new Point(0, 0),
|
||||
new Point(DEFAULT_WIDTH.convertToPixels(), DEFAULT_HEIGHT.convertToPixels()) };
|
||||
|
||||
protected Color boardColor = BOARD_COLOR;
|
||||
protected Color borderColor = BORDER_COLOR;
|
||||
|
||||
Reference in New Issue
Block a user