Skip to content

Commit

Permalink
Fix: Mouse button event is not handled properly from Blender 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nutti committed Nov 9, 2024
1 parent 7a18223 commit 1ebda27
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/screencast_keys/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,16 @@ def draw_image(img, positions, tex_coords):

if image_name_base in bpy.data.images:
draw_image(bpy.data.images[image_name_base], positions, tex_coords)
if left_button_status in ('PRESS', 'CLICK_DRAG') and (image_name_overlay_lmouse in bpy.data.images):
if left_button_status in ('PRESS', 'CLICK_DRAG') and \
(image_name_overlay_lmouse in bpy.data.images):
draw_image(bpy.data.images[image_name_overlay_lmouse], positions,
tex_coords)
if right_button_status in ('PRESS', 'CLICK_DRAG') and (image_name_overlay_rmouse in bpy.data.images):
if right_button_status in ('PRESS', 'CLICK_DRAG') and \
(image_name_overlay_rmouse in bpy.data.images):
draw_image(bpy.data.images[image_name_overlay_rmouse], positions,
tex_coords)
if middle_button_status in ('PRESS', 'CLICK_DRAG') and (image_name_overlay_mmouse in bpy.data.images):
if middle_button_status in ('PRESS', 'CLICK_DRAG') and \
(image_name_overlay_mmouse in bpy.data.images):
draw_image(bpy.data.images[image_name_overlay_mmouse], positions,
tex_coords)

Expand Down Expand Up @@ -1749,10 +1752,10 @@ def update_mouse_buttons_status(self, event):
for k in self.mouse_buttons_status.keys():
self.mouse_buttons_status[k] = 'RELEASE'
else:
for k in self.mouse_buttons_status.keys():
for k, v in self.mouse_buttons_status.items():
if k == 'MIDDLEMOUSE':
continue
if k == 'LEFTMOUSE' and self.mouse_buttons_status[k] == 'CLICK_DRAG':
if k == 'LEFTMOUSE' and v == 'CLICK_DRAG':
continue
self.mouse_buttons_status[k] = 'RELEASE'

Expand Down

0 comments on commit 1ebda27

Please sign in to comment.