Fixed ghost track rotation on rear ends
Recalculation on track edit end Changes rendering of ties to be evenly spaced Fixes ghost and held track rendering
This commit is contained in:
@@ -121,18 +121,20 @@ export class EditTrackState extends State<States> {
|
||||
);
|
||||
this.ghostRotated = true;
|
||||
break;
|
||||
case "back":
|
||||
case "back": {
|
||||
this.ghostSegment.setPositionByPoint(
|
||||
this.closestEnd.pos,
|
||||
this.ghostSegment.points[3],
|
||||
);
|
||||
const ghostEndTangent = this.ghostSegment.tangent(1);
|
||||
// this.ghostSegment.points[3] = this.closestEnd.pos;
|
||||
!this.ghostRotated && this.ghostSegment.rotateAboutPoint(
|
||||
this.closestEnd.tangent.heading(),
|
||||
this.closestEnd.tangent.heading() - ghostEndTangent.heading(),
|
||||
this.ghostSegment.points[3],
|
||||
);
|
||||
this.ghostRotated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// } else if (closestEnd) {
|
||||
// this.closestEnd = closestEnd;
|
||||
@@ -258,11 +260,11 @@ export class EditTrackState extends State<States> {
|
||||
const doodler = getContextItem<Doodler>("doodler");
|
||||
this.layers.push(
|
||||
doodler.createLayer(() => {
|
||||
this.selectedSegment?.draw();
|
||||
this.selectedSegment?.draw(false, true);
|
||||
if (this.ghostSegment) {
|
||||
doodler.drawWithAlpha(0.5, () => {
|
||||
if (!this.ghostSegment) return;
|
||||
this.ghostSegment.draw();
|
||||
this.ghostSegment.draw(false, true);
|
||||
if (getContextItemOrDefault("debug", false)) {
|
||||
const colors = getContextItem<string[]>("colors");
|
||||
for (
|
||||
@@ -396,6 +398,9 @@ export class EditTrackState extends State<States> {
|
||||
getContextItem<Doodler>("doodler").deleteLayer(layer);
|
||||
}
|
||||
|
||||
const track = getContextItem<TrackSystem>("track");
|
||||
track.recalculateAll();
|
||||
|
||||
const inputManager = getContextItem<InputManager>("inputManager");
|
||||
inputManager.offKey("e");
|
||||
inputManager.offKey("w");
|
||||
|
Reference in New Issue
Block a user