def setControlPos(self, value):
        value_x = value[0]
        value_y = value[1]

        widget_width = self.getOffsetWidth()
        length_range = widget_width - 10 # handle width is hard-coded
        val_diff_x = self.max_value_x - self.min_value_x
        relative_x = length_range * (value_x - self.min_value_x) / val_diff_x

        # limit the position to be in the widget!
        if relative_x < 0:
            relative_x = 0
        if relative_x >= length_range:
            relative_x = length_range

        widget_height = self.getOffsetHeight()
        height_range = widget_height - 10 # handle height is hard-coded
        val_diff_y = self.max_value_y - self.min_value_y
        relative_y = height_range * (value_y - self.min_value_y) / val_diff_y

        # limit the position to be in the widget!
        if relative_y < 0:
            relative_y = 0
        if relative_y >= height_range:
            relative_y = height_range

        relative_y = height_range - relative_y # turn round (bottom to top)

        # move the handle
        DOM.setStyleAttribute(self.handle, "top", "%dpx" % relative_y)
        DOM.setStyleAttribute(self.handle, "left", "%dpx" % relative_x) 
        DOM.setStyleAttribute(self.handle, "position", "absolute")
dataset/ETHPy150Open anandology/pyjamas/library/gwt/ui/AreaSlider.py/AreaSlider.setControlPos/original