From: Justin Nesselrotte Date: Wed, 31 Dec 2014 08:47:29 +0000 (-0600) Subject: Fixes button offset issue for glComboButton's drop down buttons X-Git-Tag: 14.09-1.18~5^2~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=57600b4bc49d1b6313dad65eadc4f50fb66f9dd0;p=cura.git Fixes button offset issue for glComboButton's drop down buttons --- diff --git a/Cura/gui/util/openglGui.py b/Cura/gui/util/openglGui.py index 9ed845f8..5669249c 100644 --- a/Cura/gui/util/openglGui.py +++ b/Cura/gui/util/openglGui.py @@ -634,7 +634,8 @@ class glComboButton(glButton): def setValue(self, value): self._selection = value - self._imageID = self._imageIDs[self._selection] + self._imageID = self._imageIDs[self._selection+1] + print self._imageID self._comboCallback() def OnMouseDown(self, x, y, button): @@ -642,9 +643,12 @@ class glComboButton(glButton): return False if self.hasFocus(): bs = self._base._buttonSize / 1.3 - pos = self._getPixelPos() - if 0 <= x - pos[0] <= bs and 0 <= y - pos[1] - bs <= bs * len(self._imageIDs): - self._selection = int((y - pos[1] - bs) / bs) + pos = self.getSize() + offsetX = pos[0] + (self._base._buttonSize - bs) + offsetY = pos[1] + self._base._buttonSize + + if 0 <= x - offsetX <= bs and 0 <= y - offsetY <= bs * len(self._imageIDs): + self._selection = int((y - offsetY) / bs) self._imageID = self._imageIDs[self._selection] self._base._focus = None self._comboCallback()