bugfix: imprecision in drawing
scenario: slowly press down mouse button and drag to draw a line release mouse button Before this commit the point would jump just a little bit on release, and points would go slightly to the left of where I expect. Yet another thing it's hard to write an automated test for.
This commit is contained in:
parent
f72185ab19
commit
65879591ca
|
@ -12,6 +12,7 @@ record those here.
|
|||
* How the screen looks. Our tests use a level of indirection to check text and
|
||||
graphics printed to screen, but not the precise pixels they translate to.
|
||||
- where exactly the cursor is drawn to highlight a given character
|
||||
- analogously, how a shape precisely looks as you draw it
|
||||
|
||||
### Other compromises
|
||||
|
||||
|
|
|
@ -126,6 +126,9 @@ function Drawing.draw_pending_shape(drawing, top, left,right)
|
|||
local function py(y) return Drawing.pixels(y, width)+top end
|
||||
local mx = Drawing.coord(pmx-left, width)
|
||||
local my = Drawing.coord(pmy-top, width)
|
||||
-- recreate pixels from coords to precisely mimic how the drawing will look
|
||||
-- after mouse_released
|
||||
pmx,pmy = px(mx), py(my)
|
||||
local shape = drawing.pending
|
||||
if shape.mode == nil then
|
||||
-- nothing pending
|
||||
|
|
Loading…
Reference in New Issue