mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Rotating and mirroring boards that display coordinates also changes
coordinate origin
This commit is contained in:
@@ -3330,6 +3330,10 @@
|
|||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>When rotating Vero and Tri-Pad boards, change the orientation of strips to match the rotation angle</description>
|
<description>When rotating Vero and Tri-Pad boards, change the orientation of strips to match the rotation angle</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Rotating and mirroring boards that display coordinates also changes coordinate origin</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Dragging components from the component tree to the canvas stops working once the component type is selected in the tree</description>
|
<description>Dragging components from the component tree to the canvas stops working once the component type is selected in the tree</description>
|
||||||
|
|||||||
Binary file not shown.
@@ -27,7 +27,7 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
import org.diylc.components.transform.SimpleComponentTransformer;
|
import org.diylc.components.transform.AbstractBoardTransformer;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
@@ -43,7 +43,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Eyelet Board", category = "Boards", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Eyelet Board", category = "Boards", author = "Branislav Stojkovic",
|
||||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with eyelets",
|
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with eyelets",
|
||||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME,
|
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME,
|
||||||
transformer = SimpleComponentTransformer.class, enableCache = true)
|
transformer = AbstractBoardTransformer.class, enableCache = true)
|
||||||
public class EyeletBoard extends AbstractBoard {
|
public class EyeletBoard extends AbstractBoard {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
import org.diylc.components.transform.SimpleComponentTransformer;
|
import org.diylc.components.transform.AbstractBoardTransformer;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
@@ -45,7 +45,7 @@ import org.diylc.utils.Constants;
|
|||||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board",
|
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board",
|
||||||
description = "Perforated board as found on some Marshall and Trainwreck amps",
|
description = "Perforated board as found on some Marshall and Trainwreck amps",
|
||||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||||
keywordTag = "Perf Board", transformer = SimpleComponentTransformer.class)
|
keywordTag = "Perf Board", transformer = AbstractBoardTransformer.class)
|
||||||
public class MarshallPerfBoard extends AbstractBoard {
|
public class MarshallPerfBoard extends AbstractBoard {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
import org.diylc.components.transform.SimpleComponentTransformer;
|
import org.diylc.components.transform.AbstractBoardTransformer;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
@@ -44,7 +44,7 @@ import org.diylc.utils.Constants;
|
|||||||
@ComponentDescriptor(name = "Perf Board w/ Pads", category = "Boards", author = "Branislav Stojkovic",
|
@ComponentDescriptor(name = "Perf Board w/ Pads", category = "Boards", author = "Branislav Stojkovic",
|
||||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with solder pads",
|
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with solder pads",
|
||||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||||
keywordTag = "Perf Board", transformer = SimpleComponentTransformer.class, enableCache = true)
|
keywordTag = "Perf Board", transformer = AbstractBoardTransformer.class, enableCache = true)
|
||||||
public class PerfBoard extends AbstractBoard {
|
public class PerfBoard extends AbstractBoard {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package org.diylc.components.transform;
|
||||||
|
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
|
import org.diylc.common.IComponentTransformer;
|
||||||
|
import org.diylc.components.boards.AbstractBoard;
|
||||||
|
import org.diylc.components.boards.AbstractBoard.CoordinateOrigin;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
|
public class AbstractBoardTransformer extends SimpleComponentTransformer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(IDIYComponent<?> component, Point2D center, int direction) {
|
||||||
|
super.rotate(component, center, direction);
|
||||||
|
|
||||||
|
AbstractBoard board = (AbstractBoard)component;
|
||||||
|
CoordinateOrigin origin = board.getCoordinateOrigin();
|
||||||
|
|
||||||
|
if (direction == IComponentTransformer.CLOCKWISE) {
|
||||||
|
switch (origin) {
|
||||||
|
case Bottom_Left:
|
||||||
|
origin = CoordinateOrigin.Top_Left;
|
||||||
|
break;
|
||||||
|
case Bottom_Right:
|
||||||
|
origin = CoordinateOrigin.Bottom_Left;
|
||||||
|
break;
|
||||||
|
case Top_Left:
|
||||||
|
origin = CoordinateOrigin.Top_Right;
|
||||||
|
break;
|
||||||
|
case Top_Right:
|
||||||
|
origin = CoordinateOrigin.Bottom_Right;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (origin) {
|
||||||
|
case Bottom_Left:
|
||||||
|
origin = CoordinateOrigin.Bottom_Right;
|
||||||
|
break;
|
||||||
|
case Bottom_Right:
|
||||||
|
origin = CoordinateOrigin.Top_Right;
|
||||||
|
break;
|
||||||
|
case Top_Left:
|
||||||
|
origin = CoordinateOrigin.Bottom_Left;
|
||||||
|
break;
|
||||||
|
case Top_Right:
|
||||||
|
origin = CoordinateOrigin.Top_Left;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
board.setCoordinateOrigin(origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mirror(IDIYComponent<?> component, Point2D center, int direction) {
|
||||||
|
super.mirror(component, center, direction);
|
||||||
|
|
||||||
|
AbstractBoard board = (AbstractBoard)component;
|
||||||
|
CoordinateOrigin origin = board.getCoordinateOrigin();
|
||||||
|
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||||
|
switch (origin) {
|
||||||
|
case Bottom_Left:
|
||||||
|
origin = CoordinateOrigin.Bottom_Right;
|
||||||
|
break;
|
||||||
|
case Bottom_Right:
|
||||||
|
origin = CoordinateOrigin.Bottom_Left;
|
||||||
|
break;
|
||||||
|
case Top_Left:
|
||||||
|
origin = CoordinateOrigin.Top_Right;
|
||||||
|
break;
|
||||||
|
case Top_Right:
|
||||||
|
origin = CoordinateOrigin.Top_Left;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (origin) {
|
||||||
|
case Bottom_Left:
|
||||||
|
origin = CoordinateOrigin.Top_Left;
|
||||||
|
break;
|
||||||
|
case Bottom_Right:
|
||||||
|
origin = CoordinateOrigin.Top_Right;
|
||||||
|
break;
|
||||||
|
case Top_Left:
|
||||||
|
origin = CoordinateOrigin.Bottom_Left;
|
||||||
|
break;
|
||||||
|
case Top_Right:
|
||||||
|
origin = CoordinateOrigin.Top_Right;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
board.setCoordinateOrigin(origin);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ import org.diylc.common.OrientationHV;
|
|||||||
import org.diylc.components.boards.AbstractVeroBoard;
|
import org.diylc.components.boards.AbstractVeroBoard;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
|
||||||
public class VeroBoardTransformer extends SimpleComponentTransformer {
|
public class VeroBoardTransformer extends AbstractBoardTransformer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rotate(IDIYComponent<?> component, Point2D center, int direction) {
|
public void rotate(IDIYComponent<?> component, Point2D center, int direction) {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user