better handle moving points

This should hopefully address #5. I'm removing some constraints from
manhattan lines, rectangles and squares.
This commit is contained in:
Kartik K. Agaram 2022-06-17 21:40:59 -07:00
parent efbbdfc586
commit f3abc2cbf2
2 changed files with 5 additions and 15 deletions

View File

@ -91,21 +91,6 @@ found anything amiss: http://akkartik.name/contact
* No clipping yet for drawings. In particular, circles/squares/rectangles and
point labels can overflow a drawing.
* Insufficient handling of constraints when moving points. For example, if you
draw a manhattan line and then move one of the points, you may not be able
to hover on it anymore.
There's two broad ways to fix this. The first is to relax constraints,
switch the manhattan line to not be manhattan. The second is to try to
maintain constraints. Either constrain the point to only move along one line
(but what if it's connected to two manhattan lines?!), or constrain the
other end of the line to move alongside. I'm not sure yet which would be
more useful. Getting into constraints would also make the program more
complex.
Bottomline: at the moment moving points connected to manhattan lines,
rectangles or squares can break drawings in subtle ways.
* Touchpads can drag the mouse pointer using a light touch or a heavy click.
On Linux, drags using the light touch get interrupted when a key is pressed.
You'll have to press down to drag.

View File

@ -248,6 +248,11 @@ function Drawing.update()
elseif Current_drawing_mode == 'move' then
if Drawing.in_drawing(drawing, x, y) then
local mx,my = Drawing.coord(x-Margin_left), Drawing.coord(y-drawing.y)
if drawing.mode == 'manhattan' then
drawing.mode = 'line'
elseif drawing.mode == 'rectangle' or drawing.mode == 'square' then
drawing.mode = 'polygon'
end
drawing.pending.target_point.x = mx
drawing.pending.target_point.y = my
end