Fix sector offset transformation in Edit Selection mode (PR#274 by mykola-ambar)

This commit is contained in:
mykola-ambar 2019-09-20 21:49:30 +03:00 committed by jewalky
parent 6e0acdf789
commit c6b879bb1a

View file

@ -893,13 +893,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
float texrotation = Angle2D.PI2 - rotation; float texrotation = Angle2D.PI2 - rotation;
// Update texture offsets // Update texture offsets
if(transformoffsets) if (transformoffsets)
{ {
Vector2D toffset = (selectionbasecenter - selectioncenter).GetRotated((texrotation + si.Rotation)); float trotation = rotateoffsets ? (si.Rotation + texrotation) : (si.Rotation);
Vector2D soffset = si.Offset.GetRotated(texrotation + si.Rotation); Vector2D offset = selectioncenter.GetRotated(trotation);
fields["xpanning" + si.Part] = new UniValue(UniversalType.Float, (float)Math.Round(-offset.x, General.Map.FormatInterface.VertexDecimals));
fields["ypanning" + si.Part] = new UniValue(UniversalType.Float, (float)Math.Round(offset.y, General.Map.FormatInterface.VertexDecimals));
fields["xpanning" + si.Part] = new UniValue(UniversalType.Float, (float)Math.Round(soffset.x + toffset.x, General.Map.FormatInterface.VertexDecimals) % si.TextureSize.Width);
fields["ypanning" + si.Part] = new UniValue(UniversalType.Float, (float)Math.Round(-(soffset.y + toffset.y), General.Map.FormatInterface.VertexDecimals) % si.TextureSize.Height);
} }
// Restore texture offsets // Restore texture offsets
else else
@ -1825,7 +1826,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.RenderRectangleFilled(rotategrips[i], General.Colors.Background, true); renderer.RenderRectangleFilled(rotategrips[i], General.Colors.Background, true);
renderer.RenderRectangle(rotategrips[i], 2, General.Colors.Indication, true); renderer.RenderRectangle(rotategrips[i], 2, General.Colors.Indication, true);
} }
renderer.Finish(); renderer.Finish();
} }