Skip to content

Commit

Permalink
fix: hide thumbnail when dragging timeline
Browse files Browse the repository at this point in the history
ref #358
  • Loading branch information
tomasklaen committed Mar 29, 2023
1 parent 984f8aa commit 00daff7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/uosc_shared/elements/Timeline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function Timeline:handle_cursor_down()
mp.set_property_native('pause', true)
self:set_from_cursor()
cursor.on_primary_up = function() self:handle_cursor_up() end
self:clear_thumbnail()
end
function Timeline:on_prop_duration() self:decide_enabled() end
function Timeline:on_prop_time() self:decide_enabled() end
Expand Down Expand Up @@ -376,7 +377,7 @@ function Timeline:render()
tooltip_anchor.ay = tooltip_anchor.ay - self.font_size - offset

-- Thumbnail
if not thumbnail.disabled and thumbnail.width ~= 0 and thumbnail.height ~= 0 then
if not thumbnail.disabled and not self.pressed and thumbnail.width ~= 0 and thumbnail.height ~= 0 then
local scale_x, scale_y = display.scale_x, display.scale_y
local border, margin_x, margin_y = math.ceil(2 * scale_x), round(10 * scale_x), round(5 * scale_y)
local thumb_x_margin, thumb_y_margin = border + margin_x, border + margin_y
Expand Down

7 comments on commit 00daff7

@hooke007
Copy link
Contributor

@hooke007 hooke007 commented on 00daff7 Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing with my original plan, this way would generate the unnecessary flicker when clicking on the timeline.
I tried to improve a little, but I still don't know how to totally fix it.

@hooke007
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomasklaen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what the issue is. I'm trying clicking while mouse doesn't move, then moving, and various combinations of not moving, moving, dragging, clicking, and everything works as I'd expect.

Are you talking about the screen going a bit dark on your 1st video? That flickering? If so, I have no idea what that is. It's not happening on my end.

@hooke007
Copy link
Contributor

@hooke007 hooke007 commented on 00daff7 Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you talking about the screen going a bit dark on your 1st video

No.
What I mean is that, hiding should only happen when draging.
Probably not a issue, a preference instead.

test3.mp4

@tomasklaen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed by 19f421f.

@hooke007
Copy link
Contributor

@hooke007 hooke007 commented on 00daff7 Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some tests, Hmm... Overall it looked good except a little bit increasing of performance (See RED part in the img). (I kept dragging and observe the task manager's info)
Considering dragging for a long time is not a common action, so I could ignore this issue and just leave it here.

P.S. My commits(ORANGE) based on #358 use less power.
Snipaste_2023-03-29_22-27-24

@tomasklaen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see or can think of any obvious culprit if there really is a performance hit here. There's no way keeping track of dragging distance would cause this.

Please sign in to comment.