hoist couple of variables out

[?]
Jul 13, 2022, 3:21 PM
BXJMGTV2FMXDI5ML3OATRJ6O35L3T64S4TW4UYM37V3K3DICSC4AC

Dependencies

  • [2] EHSUSZMK more idiomatic variable names
  • [3] BXYVMS4A use available variables
  • [4] KTZQ57HV replace globals with args in a few functions
  • [5] LF7BWEG4 group all editor globals
  • [6] PJEQCTBL add state arg to Drawing.update
  • [7] P5QNVXSN drop final mention of state global beyond main.lua
  • [8] JFFUF5AL override mouse state lookups in tests
  • [9] DRFE3B3Z mouse buttons are integers, not strings
  • [10] RT6EV6OP delegate update events to drawings
  • [11] UHB4GARJ left/right margin -> left/right coordinates
  • [12] LAW2O3NW extract variable Margin_left
  • [*] BLWAYPKV extract a module

Change contents

  • edit in drawing.lua at line 244
    [4.254]
    [2.17]
    if drawing.y == nil then
    return -- first draw?
    end
  • edit in drawing.lua at line 248
    [2.65]
    [4.1585]
    local mx = Drawing.coord(pmx-State.left, State.width)
    local my = Drawing.coord(pmy-drawing.y, State.width)
  • replacement in drawing.lua at line 253
    [4.433][3.17:155]()
    table.insert(drawing.pending.points, {x=Drawing.coord(pmx-State.left, State.width), y=Drawing.coord(pmy-drawing.y, State.width)})
    [4.433]
    [4.565]
    table.insert(drawing.pending.points, {x=mx, y=my})
  • edit in drawing.lua at line 255
    [4.614][2.140:248]()
    local mx,my = Drawing.coord(pmx-State.left, State.width), Drawing.coord(pmy-drawing.y, State.width)
  • edit in drawing.lua at line 262
    [2.323][2.323:429]()
    local mx,my = Drawing.coord(pmx-State.left, State.width), Drawing.coord(pmy-drawing.y, State.width)