Skip to content

Commit

Permalink
Fixed svg export for moved/offset brush strokes
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrlabs committed Aug 27, 2024
1 parent b853055 commit 56830b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Translations: Ukrainian, Arabic

### Fixed
- Fixed SVG export for brush strokes that have been moved using the move tool
- Made zooming to the mouse cursor in the canvas more accurate

### Changed
- Migrated from Godot 3.5.x to Godot 4.3
Expand Down
8 changes: 4 additions & 4 deletions lorien/Misc/SvgExporter.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ func export_svg(strokes: Array[BrushStroke], background: Color, path: String) ->
var max_dim := BrushStroke.MIN_VECTOR2
var min_dim := BrushStroke.MAX_VECTOR2
for stroke in strokes:
min_dim.x = min(min_dim.x, stroke.top_left_pos.x)
min_dim.y = min(min_dim.y, stroke.top_left_pos.y)
max_dim.x = max(max_dim.x, stroke.bottom_right_pos.x)
max_dim.y = max(max_dim.y, stroke.bottom_right_pos.y)
min_dim.x = min(min_dim.x, stroke.top_left_pos.x + stroke.global_position.x)
min_dim.y = min(min_dim.y, stroke.top_left_pos.y + stroke.global_position.y)
max_dim.x = max(max_dim.x, stroke.bottom_right_pos.x + stroke.global_position.x)
max_dim.y = max(max_dim.y, stroke.bottom_right_pos.y + stroke.global_position.y)
var size := max_dim - min_dim
var margin_size := size * EDGE_MARGIN
size += margin_size*2.0
Expand Down

0 comments on commit 56830b2

Please sign in to comment.