mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +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.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.core.CreationMethod;
|
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
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) {
|
public void mouseMoved(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
||||||
Map<IDIYComponent<?>, Set<Integer>> components = new HashMap<IDIYComponent<?>, Set<Integer>>();
|
Map<IDIYComponent<?>, Set<Integer>> components = new HashMap<IDIYComponent<?>, Set<Integer>>();
|
||||||
Point scaledPoint = scalePoint(point);
|
Point scaledPoint = scalePoint(point);
|
||||||
if (componentSlot != null
|
if (componentSlot != null) {
|
||||||
&& (componentSlot.getCreationMethod() == CreationMethod.POINT_BY_POINT || !componentSlot
|
|
||||||
.isStretchable())) {
|
|
||||||
potentialControlPoint = scaledPoint;
|
potentialControlPoint = scaledPoint;
|
||||||
snapPointToGrid(potentialControlPoint);
|
snapPointToGrid(potentialControlPoint);
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
@@ -586,12 +583,14 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
for (Integer j : entry.getValue()) {
|
for (Integer j : entry.getValue()) {
|
||||||
Point firstPoint = component.getControlPoint(i);
|
Point firstPoint = component.getControlPoint(i);
|
||||||
Point secondPoint = entry.getKey().getControlPoint(j);
|
if (entry.getKey().isControlPointSticky(j)) {
|
||||||
// If they are close enough we can consider them
|
Point secondPoint = entry.getKey().getControlPoint(j);
|
||||||
// matched.
|
// If they are close enough we can consider them
|
||||||
if (firstPoint.distance(secondPoint) < ProjectPainter.CONTROL_POINT_SIZE) {
|
// matched.
|
||||||
componentMatches = true;
|
if (firstPoint.distance(secondPoint) < ProjectPainter.CONTROL_POINT_SIZE) {
|
||||||
break;
|
componentMatches = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1149,16 +1148,4 @@ public class Presenter implements IPlugInPort {
|
|||||||
return point == null ? null : new Point((int) (point.x / zoomLevel),
|
return point == null ? null : new Point((int) (point.x / zoomLevel),
|
||||||
(int) (point.y / 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);
|
public static Size DEFAULT_HEIGHT = new Size(1d, SizeUnit.in);
|
||||||
|
|
||||||
protected String value;
|
protected String value;
|
||||||
protected Point[] controlPoints = new Point[] {
|
protected Point[] controlPoints = new Point[] { new Point(0, 0),
|
||||||
new Point(-DEFAULT_WIDTH.convertToPixels() / 2, -DEFAULT_HEIGHT.convertToPixels() / 2),
|
new Point(DEFAULT_WIDTH.convertToPixels(), DEFAULT_HEIGHT.convertToPixels()) };
|
||||||
new Point(DEFAULT_WIDTH.convertToPixels() / 2, DEFAULT_HEIGHT.convertToPixels() / 2) };
|
|
||||||
|
|
||||||
protected Color boardColor = BOARD_COLOR;
|
protected Color boardColor = BOARD_COLOR;
|
||||||
protected Color borderColor = BORDER_COLOR;
|
protected Color borderColor = BORDER_COLOR;
|
||||||
|
|||||||
Reference in New Issue
Block a user