trackeditor: try harder to set banking when splitting a segment
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9259 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
parent
6c7c610d73
commit
8493bbfb38
|
@ -676,10 +676,12 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
oldShape.setHeightEndRight(rightHeight);
|
||||
}
|
||||
|
||||
if (!Double.isNaN(oldShape.getBankingStart()) && !Double.isNaN(oldShape.getBankingEnd()))
|
||||
{
|
||||
double bankingStart = getBankingStart(oldShape);
|
||||
|
||||
if (!Double.isNaN(bankingStart) && !Double.isNaN(oldShape.getBankingEnd()))
|
||||
{
|
||||
newShape.setBankingEnd(oldShape.getBankingEnd());
|
||||
double banking = oldShape.getBankingStart() + (oldShape.getBankingEnd() - oldShape.getBankingStart()) * splitPoint;
|
||||
double banking = bankingStart + (oldShape.getBankingEnd() - bankingStart) * splitPoint;
|
||||
newShape.setBankingStart(banking);
|
||||
oldShape.setBankingEnd(banking);
|
||||
}
|
||||
|
@ -697,6 +699,28 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
newShape.setSurface(oldShape.getSurface());
|
||||
}
|
||||
|
||||
private double getBankingStart(Segment shape)
|
||||
{
|
||||
double banking = shape.getBankingStart();
|
||||
|
||||
if (!Double.isNaN(banking))
|
||||
{
|
||||
return banking;
|
||||
}
|
||||
|
||||
if (!Double.isNaN(shape.getHeightStart()))
|
||||
{
|
||||
return 0; // flat
|
||||
}
|
||||
|
||||
if (!Double.isNaN(shape.getHeightStartLeft()) && !Double.isNaN(shape.getHeightStartRight()))
|
||||
{
|
||||
return Math.atan2(shape.getHeightStartLeft() - shape.getHeightStartRight(), editorFrame.getTrackData().getMainTrack().getWidth()) * 180.0 / Math.PI;
|
||||
}
|
||||
|
||||
return Double.NaN;
|
||||
}
|
||||
|
||||
private ObjectMap findObjectMap(ObjShapeObject object)
|
||||
{
|
||||
for (int i = 0; i < editorFrame.getObjectMaps().size(); i++)
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Properties
|
|||
private static Properties instance = new Properties();
|
||||
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
|
||||
public final String title = "sd2-trackeditor";
|
||||
public final String version = "1.4.5";
|
||||
public final String version = "1.4.6";
|
||||
private String path;
|
||||
|
||||
private double imageScale = 1;
|
||||
|
|
Loading…
Reference in New Issue