Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def on_mouse_wheel(self, event):
self._translate += event.delta[1]
power = 7. if is_running_on_macos() else 5. # 2 ** exponent
stride = 4. if is_running_on_macos() else 7.
translate = self._translate
translate = min(power * stride, translate)
translate = max(-power * stride, translate)
self._translate = translate
self._magnification = 2 ** -(self._translate / stride)
if self._latest_translate != self._translate:
self.apply_magnification()
self._latest_translate = self._translate
def on_mouse_move(self, event):
if self._is_dragging:
adjustment = 2. if is_running_on_macos() else 1.
ratio = self._magnification * adjustment
delta = event.pos - self._origin
self._origin = event.pos
self._coordinate[0] -= (delta[0] * ratio)
self._coordinate[1] += (delta[1] * ratio)
self.apply_magnification()
def on_mouse_wheel(self, event):
self._translate += event.delta[1]
power = 7. if is_running_on_macos() else 5. # 2 ** power
stride = 4. if is_running_on_macos() else 7.
translate = self._translate
translate = min(power * stride, translate)
translate = max(-power * stride, translate)
self._translate = translate
self._magnification = 2 ** -(self._translate / stride)
if self._latest_translate != self._translate:
self.apply_magnification()
self._latest_translate = self._translate
def on_mouse_move(self, event):
if self._is_dragging:
adjustment = 2. if is_running_on_macos() else 1.
ratio = self._magnification * adjustment
delta = event.pos - self._origin
self._origin = event.pos
self._coordinate[0] -= (delta[0] * ratio)
self._coordinate[1] += (delta[1] * ratio)
self.apply_magnification()
def on_mouse_wheel(self, event):
self._translate += event.delta[1]
power = 7. if is_running_on_macos() else 5. # 2 ** power
stride = 4. if is_running_on_macos() else 7.
translate = self._translate
translate = min(power * stride, translate)
translate = max(-power * stride, translate)
self._translate = translate
self._magnification = 2 ** -(self._translate / stride)
if self._latest_translate != self._translate:
self.apply_magnification()
self._latest_translate = self._translate
def on_mouse_move(self, event):
if self._is_dragging:
adjustment = 2. if is_running_on_macos() else 1.
ratio = self._magnification * adjustment
delta = event.pos - self._origin
self._origin = event.pos
self._coordinate[0] -= (delta[0] * ratio)
self._coordinate[1] += (delta[1] * ratio)
self.apply_magnification()
def on_mouse_wheel(self, event):
self._translate += event.delta[1]
power = 7. if is_running_on_macos() else 5. # 2 ** exponent
stride = 4. if is_running_on_macos() else 7.
translate = self._translate
translate = min(power * stride, translate)
translate = max(-power * stride, translate)
self._translate = translate
self._magnification = 2 ** -(self._translate / stride)
if self._latest_translate != self._translate:
self.apply_magnification()
self._latest_translate = self._translate