Skip to content

Commit

Permalink
Ruler - Draw current mouse position marker.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpobst committed Jan 24, 2022
1 parent bf6d05a commit 4e3ec18
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Pinta.Gui.Widgets/Widgets/Ruler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,26 @@ protected override bool OnDrawn (Context cr)
}

cr.Stroke ();
}

// TODO-GTK3 - cache the ticks, and update the marker's position as the mouse moves.

}

// Draw marker
var marker_position = (Position - Lower) * (awidth / (Upper - Lower));

switch (Orientation) {
case Orientation.Horizontal:
cr.MoveTo (marker_position, border.Top);
cr.LineTo (marker_position, border.Top + rheight);
break;
case Orientation.Vertical:
cr.MoveTo (border.Left, marker_position);
cr.LineTo (border.Left + rheight, marker_position);
break;
}

cr.Stroke ();

// TODO-GTK3 - cache the ticks

return base.OnDrawn (cr);
}

Expand Down

0 comments on commit 4e3ec18

Please sign in to comment.