From a6cd89f7461dc6dead586403d3ac269e9d63ede8 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Fri, 8 Dec 2023 21:14:03 +0100 Subject: [PATCH] Draft: use MarkerSize for snap and tracker markers --- src/Mod/Draft/draftguitools/gui_edit.py | 12 ++++++++---- src/Mod/Draft/draftguitools/gui_trackers.py | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_edit.py b/src/Mod/Draft/draftguitools/gui_edit.py index a20c3545cd..e2dc0dd6b8 100644 --- a/src/Mod/Draft/draftguitools/gui_edit.py +++ b/src/Mod/Draft/draftguitools/gui_edit.py @@ -547,10 +547,14 @@ class Edit(gui_base_original.Modifier): def resetTrackersBezier(self, obj): # in future move tracker definition to DraftTrackers - knotmarkers = (coin.SoMarkerSet.DIAMOND_FILLED_9_9,#sharp - coin.SoMarkerSet.SQUARE_FILLED_9_9, #tangent - coin.SoMarkerSet.HOURGLASS_FILLED_9_9) #symmetric - polemarker = coin.SoMarkerSet.CIRCLE_FILLED_9_9 #pole + param = App.ParamGet("User parameter:BaseApp/Preferences/View") + size = param.GetInt("MarkerSize", 9) + knotmarkers = ( + Gui.getMarkerIndex("DIAMOND_FILLED", size), # sharp + Gui.getMarkerIndex("SQUARE_FILLED", size), # tangent + Gui.getMarkerIndex("HOURGLASS_FILLED", size) # symmetric + ) + polemarker = Gui.getMarkerIndex("CIRCLE_FILLED", size) # pole self.trackers[obj.Name] = [] cont = obj.Continuity firstknotcont = cont[-1] if (obj.Closed and cont) else 0 diff --git a/src/Mod/Draft/draftguitools/gui_trackers.py b/src/Mod/Draft/draftguitools/gui_trackers.py index 016996b441..8b16d3fa5f 100644 --- a/src/Mod/Draft/draftguitools/gui_trackers.py +++ b/src/Mod/Draft/draftguitools/gui_trackers.py @@ -162,7 +162,8 @@ class snapTracker(Tracker): def __init__(self): self.marker = coin.SoMarkerSet() # this is the marker symbol - self.marker.markerIndex = FreeCADGui.getMarkerIndex("", 9) + param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View") + self.marker.markerIndex = FreeCADGui.getMarkerIndex("CIRCLE_FILLED", param.GetInt("MarkerSize", 9)) self.coords = coin.SoCoordinate3() # this is the coordinate self.coords.point.setValue((0, 0, 0)) node = coin.SoAnnotation() @@ -173,7 +174,8 @@ class snapTracker(Tracker): def setMarker(self, style): """Set the marker index.""" - self.marker.markerIndex = FreeCADGui.getMarkerIndex(style, 9) + param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View") + self.marker.markerIndex = FreeCADGui.getMarkerIndex(style, param.GetInt("MarkerSize", 9)) def setColor(self, color=None): """Set the color.""" @@ -697,7 +699,8 @@ class ghostTracker(Tracker): self.coords = coin.SoCoordinate3() self.coords.point.setValue((obj.X, obj.Y, obj.Z)) self.marker = coin.SoMarkerSet() # this is the marker symbol - self.marker.markerIndex = FreeCADGui.getMarkerIndex("quad", 9) + param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View") + self.marker.markerIndex = FreeCADGui.getMarkerIndex("SQUARE_FILLED", param.GetInt("MarkerSize", 9)) node = coin.SoAnnotation() selnode = coin.SoSeparator() selnode.addChild(self.coords) @@ -833,10 +836,13 @@ class editTracker(Tracker): """A node edit tracker.""" def __init__(self, pos=Vector(0, 0, 0), name=None, idx=0, objcol=None, - marker=FreeCADGui.getMarkerIndex("quad", 9), - inactive=False): + marker=None, inactive=False): self.marker = coin.SoMarkerSet() # this is the marker symbol - self.marker.markerIndex = marker + if marker is None: + param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View") + self.marker.markerIndex = FreeCADGui.getMarkerIndex("SQUARE_FILLED", param.GetInt("MarkerSize", 9)) + else: + self.marker.markerIndex = marker self.coords = coin.SoCoordinate3() # this is the coordinate self.coords.point.setValue((pos.x, pos.y, pos.z)) self.position = pos