aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Beltran del Rio <jj@r.bdr.sh>2026-02-08 22:13:22 +0100
committerRuben Beltran del Rio <jj@r.bdr.sh>2026-02-08 22:27:28 +0100
commitbc4115836358bad4d7a45f731ae7f500e0580ea4 (patch)
tree72475c87a34ae8d36fc8e5a539fd36c743d5921d
parent48d57547429de856cd4e9c0d942bdd4cd40e523c (diff)
Fix renderingHEAD4.3.1main
-rw-r--r--Map.xcodeproj/project.pbxproj16
-rw-r--r--Map/Data/MapDocument.swift26
-rw-r--r--Map/Presentation/Complex Components/MapRender/MapRenderView.swift19
3 files changed, 52 insertions, 9 deletions
diff --git a/Map.xcodeproj/project.pbxproj b/Map.xcodeproj/project.pbxproj
index 99dbbc7..4397e02 100644
--- a/Map.xcodeproj/project.pbxproj
+++ b/Map.xcodeproj/project.pbxproj
@@ -502,7 +502,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = QuickLook/QuickLook.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 75;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_USER_SELECTED_FILES = readonly;
@@ -516,7 +516,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.5;
- MARKETING_VERSION = 4.3.0;
+ MARKETING_VERSION = 4.3.1;
PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Map.QuickLook;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
@@ -532,7 +532,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = QuickLook/QuickLook.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 75;
ENABLE_APP_SANDBOX = YES;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_USER_SELECTED_FILES = readonly;
@@ -546,7 +546,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.5;
- MARKETING_VERSION = 4.3.0;
+ MARKETING_VERSION = 4.3.1;
PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Map.QuickLook;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
@@ -691,7 +691,7 @@
CODE_SIGN_ENTITLEMENTS = Map/Map.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 75;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Map/Preview Content\"";
ENABLE_APP_SANDBOX = YES;
@@ -708,7 +708,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14;
- MARKETING_VERSION = 4.3.0;
+ MARKETING_VERSION = 4.3.1;
PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Map;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
@@ -727,7 +727,7 @@
CODE_SIGN_ENTITLEMENTS = Map/Map.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 70;
+ CURRENT_PROJECT_VERSION = 75;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Map/Preview Content\"";
ENABLE_APP_SANDBOX = YES;
@@ -744,7 +744,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14;
- MARKETING_VERSION = 4.3.0;
+ MARKETING_VERSION = 4.3.1;
PRODUCT_BUNDLE_IDENTIFIER = systems.tranquil.Map;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
diff --git a/Map/Data/MapDocument.swift b/Map/Data/MapDocument.swift
index df77abf..4d3350c 100644
--- a/Map/Data/MapDocument.swift
+++ b/Map/Data/MapDocument.swift
@@ -60,9 +60,33 @@ struct MapDocument: FileDocument {
@MainActor
func exportAsImage(withEvolution selectedEvolution: StageType) -> NSImage? {
+ let renderableMap = RenderableMap.from(self.parsed)
+ let mapSize = Dimensions.Map.size
+ let vertexSize = CGSize(width: 25.0, height: 25.0)
+ let useSmartLabels = UserDefaults.standard.bool(forKey: "useSmartLabelPositioning")
+
+ var labelPositions: [Int: CGPoint] = [:]
+ if useSmartLabels {
+ let axisLines = [
+ Line(start: CGPoint(x: 0, y: 0), end: CGPoint(x: 0, y: mapSize.height)),
+ Line(
+ start: CGPoint(x: 0, y: mapSize.height),
+ end: CGPoint(x: mapSize.width, y: mapSize.height)),
+ ]
+ for vertex in renderableMap.vertices {
+ labelPositions[vertex.id] = SmartLabelPositioning.calculateOptimalLabelPosition(
+ for: vertex, mapSize: mapSize, vertexSize: vertexSize,
+ edges: renderableMap.edges, opportunities: renderableMap.opportunities,
+ inertias: renderableMap.inertias, axisLines: axisLines,
+ allVertices: renderableMap.vertices, notes: renderableMap.notes)
+ }
+ }
+
let renderView = MapRenderView(
parsedMap: self.parsed,
- evolution: .constant(selectedEvolution))
+ evolution: .constant(selectedEvolution),
+ precomputedMap: renderableMap,
+ precomputedLabelPositions: labelPositions)
let renderer = ImageRenderer(content: renderView)
return renderer.nsImage
diff --git a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift
index e2e5004..3811e55 100644
--- a/Map/Presentation/Complex Components/MapRender/MapRenderView.swift
+++ b/Map/Presentation/Complex Components/MapRender/MapRenderView.swift
@@ -38,6 +38,25 @@ struct MapRenderView: View {
@State private var smartLabelPositions: [Int: CGPoint] = [:]
@State private var parseTask: Task<Void, Never>?
+ init(
+ parsedMap: WmapParser.Map, evolution: Binding<StageType>,
+ onDragVertex: @escaping (Vertex, CGFloat, CGFloat) -> Void = { _, _, _ in }
+ ) {
+ self.parsedMap = parsedMap
+ self._evolution = evolution
+ self.onDragVertex = onDragVertex
+ }
+
+ init(
+ parsedMap: WmapParser.Map, evolution: Binding<StageType>, precomputedMap: RenderableMap,
+ precomputedLabelPositions: [Int: CGPoint] = [:]
+ ) {
+ self.parsedMap = parsedMap
+ self._evolution = evolution
+ self._renderableMap = State(initialValue: precomputedMap)
+ self._smartLabelPositions = State(initialValue: precomputedLabelPositions)
+ }
+
let mapSize = Dimensions.Map.size
let padding = Dimensions.Map.padding