round coordinates to integers in a few places

[?]
Jul 30, 2022, 4:54 AM
KJQ5FEYVVQJTQ5YKHK77CQ7QWVUPW5LO3K7PK2CPJ447WD5UYUVAC

Dependencies

  • [2] 65HNIAOS make freehand drawings smoother
  • [3] XNFTJHC4 split keyboard handling between Text and Drawing
  • [4] SRVDX4I5 local var
  • [5] 6DE7RBZ6 move mouse_released events to Drawing
  • [6] LF7BWEG4 group all editor globals
  • [7] 3OTESDW6 move drawing.starty into line cache
  • [8] QXVD2RIF add state arg to Drawing.mouse_released
  • [9] LAW2O3NW extract variable Margin_left
  • [10] VHQCNMAR several more modules
  • [11] WTDKUACN rectangle and square shapes
  • [12] WI7R44TD bugfix
  • [13] UHB4GARJ left/right margin -> left/right coordinates
  • [14] P5QNVXSN drop final mention of state global beyond main.lua
  • [*] BLWAYPKV extract a module

Change contents

  • replacement in drawing.lua at line 367
    [3.3172][3.3172:3243]()
    drawing.pending.radius = geom.dist(center.x,center.y, mx,my)
    [3.3172]
    [3.3243]
    drawing.pending.radius = round(geom.dist(center.x,center.y, mx,my))
  • replacement in drawing.lua at line 583
    [3.9531][3.9531:9624]()
    local thirdx = ((x-a*y) - a*c) / (a*a + 1)
    local thirdy = (a*(-x + a*y) - c) / (a*a + 1)
    [3.9531]
    [3.9624]
    local thirdx = round(((x-a*y) - a*c) / (a*a + 1))
    local thirdy = round((a*(-x + a*y) - c) / (a*a + 1))
  • replacement in drawing.lua at line 592
    [3.9966][3.9966:10081]()
    local fourthx = ((firstx-a*firsty) - a*c) / (a*a + 1)
    local fourthy = (a*(-firstx + a*firsty) - c) / (a*a + 1)
    [3.9966]
    [3.10081]
    local fourthx = round(((firstx-a*firsty) - a*c) / (a*a + 1))
    local fourthy = round((a*(-firstx + a*firsty) - c) / (a*a + 1))
  • replacement in drawing.lua at line 702
    [2.411][2.411:475]()
    b.x = (a.x + b.x + c.x)/3
    b.y = (a.y + b.y + c.y)/3
    [2.411]
    [2.475]
    b.x = round((a.x + b.x + c.x)/3)
    b.y = round((a.y + b.y + c.y)/3)
  • edit in drawing.lua at line 708
    [3.21510]
    [3.22708]
    function round(num)
    return math.floor(num+.5)
    end