Skip to content

Commit

Permalink
remove unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Dec 12, 2023
1 parent 554106d commit 8ce19c5
Show file tree
Hide file tree
Showing 68 changed files with 5,538 additions and 5,571 deletions.
15 changes: 0 additions & 15 deletions d2graph/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,21 +436,6 @@ func (edge *Edge) TraceToShape(points []*geo.Point, startIndex, endIndex int) (n
startingSegment.End = points[startIndex+2]
startIndex++
}
if intersections := labelBox.Intersections(startingSegment); len(intersections) > 0 {

This comment has been minimized.

Copy link
@gavin-ts

gavin-ts Dec 12, 2023

Contributor

this is the code that will trim connections to an outside bottom label's box. Therefore, we don't need to make the shape taller, then shorter after layout to get the connection to end up at the bottom of the label.

This comment has been minimized.

Copy link
@gavin-ts

gavin-ts Dec 12, 2023

Contributor

this is code that shouldn't have been deleted

overlapsOutsideLabel = true
p := intersections[0]
if len(intersections) > 1 {
p = findOuterIntersection(labelPosition, intersections)
}
// move starting segment to label intersection point
points[startIndex] = p
startingSegment.End = p
// if the segment becomes too short, just merge it with the next segment
if startIndex+1 < endIndex && startingSegment.Length() < MIN_SEGMENT_LEN {
points[startIndex+1] = points[startIndex]
startIndex++
}
}
}
}
if !overlapsOutsideLabel {
Expand Down
10 changes: 0 additions & 10 deletions d2layouts/d2elklayout/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -1116,11 +1116,6 @@ func adjustDimensions(obj *d2graph.Object) (width, height float64) {
width = go2.Max(width, float64(obj.LabelDimensions.Width))
}
}

// special handling
if obj.HasOutsideBottomLabel() || obj.Icon != nil {
height += float64(obj.LabelDimensions.Height) + label.PADDING

This comment has been minimized.

Copy link
@gavin-ts

gavin-ts Dec 12, 2023

Contributor

this is the code that shouldn't be necessary when the above code is present, although the || obj.Icon != nil part may have a different reason for this so we may only want to remove the hasOutsideBottomLabel() part

This comment has been minimized.

Copy link
@gavin-ts

gavin-ts Dec 12, 2023

Contributor

the other side effect of this code besides getting the arrowheads to stop at the label is it may increase the spacing between shapes, but spacing adjustments for shapes with outside labels/icons may be a separate issue

}
}

if obj.Icon != nil && obj.Shape.Value != d2target.ShapeImage {
Expand Down Expand Up @@ -1189,11 +1184,6 @@ func cleanupAdjustment(obj *d2graph.Object) {
}
}

// special handling to start/end connections below label
if obj.HasOutsideBottomLabel() {
obj.Height -= float64(obj.LabelDimensions.Height) + label.PADDING

This comment has been minimized.

Copy link
@gavin-ts

gavin-ts Dec 12, 2023

Contributor

this also shouldn't be necessary if we no longer add this height for shapes with outside bottom labels

}

// remove the extra width/height we added for 3d/multiple after all objects/connections are placed
// and shift the shapes down accordingly
dx, dy := obj.GetModifierElementAdjustments()
Expand Down
568 changes: 284 additions & 284 deletions d2renderers/d2sketch/testdata/twitter/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
568 changes: 284 additions & 284 deletions d2renderers/d2sketch/testdata/twitter_dark/sketch.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
568 changes: 284 additions & 284 deletions d2renderers/d2svg/dark_theme/testdata/twitter/dark_theme.exp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8ce19c5

Please sign in to comment.