fixed bug in draft dimensions editmode

This commit is contained in:
Yorik van Havre 2012-01-10 20:24:31 -02:00
parent f584f47323
commit 8c18fcaec4
2 changed files with 13 additions and 9 deletions

View File

@ -1429,7 +1429,7 @@ class _ViewProviderDimension:
obj.addProperty("App::PropertyLength","LineWidth","Base","Line width")
obj.addProperty("App::PropertyColor","LineColor","Base","Line color")
obj.addProperty("App::PropertyLength","ExtLines","Base","Ext lines")
obj.addProperty("App::PropertyVector","Position","Base","The position of the text. Leave (0,0,0) for automatic position")
obj.addProperty("App::PropertyVector","TextPosition","Base","The position of the text. Leave (0,0,0) for automatic position")
obj.addProperty("App::PropertyString","Override","Base","Text override. Use 'dim' to insert the dimension length")
obj.Proxy = self
obj.FontSize=getParam("textheight")
@ -1476,10 +1476,10 @@ class _ViewProviderDimension:
if hasattr(obj.ViewObject,"DisplayMode"):
if obj.ViewObject.DisplayMode == "3D":
offset = fcvec.neg(offset)
if obj.ViewObject.Position == Vector(0,0,0):
if obj.ViewObject.TextPosition == Vector(0,0,0):
tbase = midpoint.add(offset)
else:
tbase = obj.ViewObject.Position
tbase = obj.ViewObject.TextPosition
rot = FreeCAD.Placement(fcvec.getPlaneRotation(u,v,norm)).Rotation.Q
return p1,p2,p3,p4,tbase,norm,rot
@ -1719,7 +1719,7 @@ class _ViewProviderAngularDimension:
obj.addProperty("App::PropertyString","FontName","Base","Font name")
obj.addProperty("App::PropertyLength","LineWidth","Base","Line width")
obj.addProperty("App::PropertyColor","LineColor","Base","Line color")
obj.addProperty("App::PropertyVector","Position","Base","The position of the text. Leave (0,0,0) for automatic position")
obj.addProperty("App::PropertyVector","TextPosition","Base","The position of the text. Leave (0,0,0) for automatic position")
obj.addProperty("App::PropertyString","Override","Base","Text override. Use 'dim' to insert the dimension length")
obj.Proxy = self
obj.FontSize=getParam("textheight")

View File

@ -3080,8 +3080,9 @@ class Edit(Modifier):
if self.obj:
self.obj = self.obj[0]
# store selectable state of the object
self.selectstate = self.obj.ViewObject.Selectable
self.obj.ViewObject.Selectable = False
if hasattr(self.obj.ViewObject,"Selectable"):
self.selectstate = self.obj.ViewObject.Selectable
self.obj.ViewObject.Selectable = False
if not Draft.getType(self.obj) in ["Wire","BSpline"]:
self.ui.setEditButtons(False)
else:
@ -3148,7 +3149,8 @@ class Edit(Modifier):
t.finalize()
if self.constraintrack:
self.constraintrack.finalize()
self.obj.ViewObject.Selectable = self.selectstate
if hasattr(self.obj.ViewObject,"Selectable"):
self.obj.ViewObject.Selectable = self.selectstate
Modifier.finish(self)
plane.restore()
self.running = False
@ -3188,13 +3190,15 @@ class Edit(Modifier):
self.ui.isRelative.show()
self.editing = int(snapped['Component'][8:])
self.trackers[self.editing].off()
self.obj.ViewObject.Selectable = False
if hasattr(self.obj.ViewObject,"Selectable"):
self.obj.ViewObject.Selectable = False
if "Points" in self.obj.PropertiesList:
self.node.append(self.obj.Points[self.editing])
else:
print "finishing edit"
self.trackers[self.editing].on()
self.obj.ViewObject.Selectable = True
if hasattr(self.obj.ViewObject,"Selectable"):
self.obj.ViewObject.Selectable = True
self.numericInput(self.trackers[self.editing].get())
def update(self,v):