Modifying cursor behaviour

edited December 2015 in KLayout Development

Hi Matthias,

Thanks for creating a great layout viewing and editing tool.

One of the ways in which the editor could be improved is if there was a second cursor (shaped like a diamond or cross-hairs) that snapped to the grid so that one could see where a path or polygon's starting point will be.

I've perused the code and it seems that such behaviours are handled with ViewService objects (to catch mouse events) and ViewObjects (to draw dynamic objects on the canvas) - is this correct?

Can you provide any hints as to the general approach to take to implement this behaviour?

Thanks for any help.

Simon

Comments

  • edited November -1

    Hi Simon,

    thanks :-)

    A good starting point for such an implementation is ShapeEditService::do_mouse_move_inactive in edtServiceImpl.cc. This method gets called when the mouse is moved while there is no shape being drawn. The current implementation snaps the coordinates to the grid (or other vertices/edges) and displays the results in the status line.

    Regards,

    Matthias

Sign In or Register to comment.