Event lines: sector label position is now used as end point when targeting sectors.

This commit is contained in:
MaxED 2013-09-11 13:57:27 +00:00
parent 117e5e5911
commit 038ab51058
2 changed files with 14 additions and 11 deletions

View file

@ -224,10 +224,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
bool completeredraw = (highlighted != null) && (highlighted.Tag > 0);
// Set highlight association
if(s != null)
highlightasso.Set(new Vector2D(s.BBox.X + s.BBox.Width/2, s.BBox.Y + s.BBox.Height/2), s.Tag, UniversalType.SectorTag);
else
if (s != null) {
Vector2D center = (s.Labels.Count > 0 ? s.Labels[0].position : new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
highlightasso.Set(center, s.Tag, UniversalType.SectorTag);
} else {
highlightasso.Set(new Vector2D(), 0, 0);
}
// New association highlights something?
if((s != null) && (s.Tag > 0)) completeredraw = true;
@ -1729,9 +1731,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Make list of suitable positions
foreach(Sector s in sectors) {
List<LabelPositionInfo> list = Tools.FindLabelPositions(s);
if(list.Count > 0 && !positions.Contains(list[0].position))
positions.Add(list[0].position);
Vector2D pos = (s.Labels.Count > 0 ? s.Labels[0].position : new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
if(!positions.Contains(pos)) positions.Add(pos);
}
if(positions.Count < 1) {

View file

@ -689,8 +689,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sector s in General.Map.Map.Sectors) {
if(s.Tag == asso.tag) {
renderer.PlotSector(s, General.Colors.Indication);
if(General.Settings.GZShowEventLines)
lines.Add(new Line3D(asso.Center, new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2)));//mxd
if (General.Settings.GZShowEventLines) {
Vector2D end = (s.Labels.Count > 0 ? s.Labels[0].position : new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
lines.Add(new Line3D(asso.Center, end)); //mxd
}
}
}
@ -707,7 +709,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(l.Tag == asso.tag) {
renderer.PlotLinedef(l, General.Colors.Indication);
if(General.Settings.GZShowEventLines)
lines.Add(new Line3D(asso.Center, new Vector2D((l.Start.Position + l.End.Position) / 2)));//mxd
lines.Add(new Line3D(asso.Center, l.GetCenterPoint()));//mxd
}
}
@ -765,7 +767,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.PlotLinedef(l, General.Colors.Indication);
if(General.Settings.GZShowEventLines) //mxd
lines.Add(new Line3D(new Vector2D((l.Start.Position + l.End.Position) / 2), asso.Center)); //mxd
lines.Add(new Line3D(l.GetCenterPoint(), asso.Center)); //mxd
}
}
}
@ -792,7 +794,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.PlotLinedef(l, General.Colors.Indication);
if(General.Settings.GZShowEventLines) //mxd
lines.Add(new Line3D(new Vector2D((l.Start.Position + l.End.Position) / 2), asso.Center));
lines.Add(new Line3D(l.GetCenterPoint(), asso.Center));
}
}
}