From 962461fa807e8621331d5b608e7083be0c333cfc Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Wed, 27 Jan 2010 12:06:32 +0000 Subject: [PATCH] FIX: Resolved the mad comportment in gradient --- invesalius/gui/widgets/gradient.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/invesalius/gui/widgets/gradient.py b/invesalius/gui/widgets/gradient.py index f74e9ec..98c6e69 100755 --- a/invesalius/gui/widgets/gradient.py +++ b/invesalius/gui/widgets/gradient.py @@ -141,6 +141,16 @@ class SliderBorder(object): elif self.type == MAXBORDER and self.pos+self.width >= self.WindowWidth: self.pos = self.WindowWidth - self.width + def SetPosition(self, pos): + """ + Move the border + """ + self.pos = pos + if self.type == MINBORDER and self.pos < 0: + self.pos = 0 + elif self.type == MAXBORDER and self.pos+self.width >= self.WindowWidth: + self.pos = self.WindowWidth - self.width + def GetCursor(self): """ This function returns the cursor related to the SliderBorder @@ -432,7 +442,10 @@ class GradientPanel(wx.Panel): slide = x - self.MousePositionX self.MousePositionX += slide self.SetCursor(self.SelectedObject.GetCursor()) - self.SelectedObject.DoSlide(slide) + if isinstance(self.SelectedObject, SliderControl): + self.SelectedObject.DoSlide(slide) + else: + self.SelectedObject.SetPosition(x) self.Slider.Calculate(self.SelectedObject) if self.GetMin() >= self.GetMax(): self.SetMinValue(self.GetMax()-1) -- libgit2 0.21.2