correct commit f3abc2cbf2

[?]
Jun 18, 2022, 5:52 AM
LYN3L74WRXZI4KNNIMNLPRFQ36RAGPWNE2O5AMB42H3CSTI6QM6QC

Dependencies

  • [2] B4YZWV6S bugfix: checking if a point is on a manhattan line
  • [3] KAUD3YIK tests: deleting points/shapes
  • [4] AVFRVNFR better handle moving points
  • [5] WTDKUACN rectangle and square shapes
  • [6] 6UZ2JNZE yet another key conflict
  • [7] 6LIPEQ5I more robust transitions to temporary modes
  • [8] JAXPXLEB set current_drawing_index with current_drawing
  • [9] JFFUF5AL override mouse state lookups in tests
  • [10] DRFE3B3Z mouse buttons are integers, not strings
  • [11] LAW2O3NW extract variable Margin_left
  • [12] YCDYGEZU include drawing index in a few places
  • [13] VHQCNMAR several more modules
  • [14] RT6EV6OP delegate update events to drawings
  • [15] 7SFHSB47 rename
  • [16] PX7DDEMO autosave slightly less aggressively
  • [17] L6XA5EY2 test: moving a point
  • [18] XNFTJHC4 split keyboard handling between Text and Drawing
  • [19] Y4VYNEGF test: autosave after name/move/delete of point
  • [*] K2X6G75Z start writing some tests for drawings
  • [*] BLWAYPKV extract a module
  • [*] 6DE7RBZ6 move mouse_released events to Drawing

Change contents

  • edit in geom.lua at line 25
    [2.481][2.481:510]()
    else
    assert(false)
  • edit in drawing_tests.lua at line 424
    [5.1076][5.1076:1137]()
    check_nil(p2.name, 'F - test_move_point/baseline/p2:name')
  • edit in drawing_tests.lua at line 460
    [3.19]
    [3.19]
    function test_move_point_on_manhattan_line()
    io.write('\ntest_move_point_on_manhattan_line')
    -- create a drawing with a manhattan line
    Filename = 'foo'
    App.screen.init{width=Margin_left+300, height=300}
    Lines = load_array{'```lines', '```', ''}
    Line_width = 256 -- drawing coordinates 1:1 with pixels
    Current_drawing_mode = 'manhattan'
    App.draw()
    App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)
    App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+46, 1)
    local drawing = Lines[1]
    check_eq(#drawing.shapes, 1, 'F - test_move_point_on_manhattan_line/baseline/#shapes')
    check_eq(#drawing.points, 2, 'F - test_move_point_on_manhattan_line/baseline/#points')
    check_eq(drawing.shapes[1].mode, 'manhattan', 'F - test_move_point_on_manhattan_line/baseline/shape:1')
    App.draw()
    -- enter 'move' mode
    App.run_after_keychord('C-u')
    check_eq(Current_drawing_mode, 'move', 'F - test_move_point_on_manhattan_line/mode:1')
    -- move point
    App.mouse_move(Margin_left+26, Margin_top+Drawing_padding_top+44)
    App.update(0.05)
    -- line is no longer manhattan
    check_eq(drawing.shapes[1].mode, 'line', 'F - test_move_point_on_manhattan_line/baseline/shape:1')
    end
  • edit in drawing.lua at line 246
    [5.772]
    [5.772]
    Drawing.relax_constraints(drawing, drawing.pending.target_point_index)
  • edit in drawing.lua at line 252
    [5.4220][4.15:204]()
    if drawing.mode == 'manhattan' then
    drawing.mode = 'line'
    elseif drawing.mode == 'rectangle' or drawing.mode == 'square' then
    drawing.mode = 'polygon'
    end
  • edit in drawing.lua at line 254
    [5.1033]
    [5.1033]
    Drawing.relax_constraints(drawing, drawing.pending.target_point_index)
  • edit in drawing.lua at line 261
    [5.1052]
    [23.54]
    function Drawing.relax_constraints(drawing, p)
    for _,shape in ipairs(drawing.shapes) do
    if shape.mode == 'manhattan' then
    if shape.p1 == p then
    shape.mode = 'line'
    elseif shape.p2 == p then
    shape.mode = 'line'
    end
    elseif shape.mode == 'rectangle' or shape.mode == 'square' then
    for _,v in ipairs(shape.vertices) do
    if v == p then
    shape.mode = 'polygon'
    end
    end
    end
    end
    end
  • replacement in drawing.lua at line 492
    [5.2665][5.16:86](),[5.3839][5.16:86](),[5.273][5.16:86]()
    local drawing_index,drawing,_,p = Drawing.select_point_at_mouse()
    [5.2665]
    [5.10152]
    local drawing_index,drawing,i,p = Drawing.select_point_at_mouse()
  • replacement in drawing.lua at line 498
    [5.10259][5.10259:10327]()
    drawing.pending = {mode=Current_drawing_mode, target_point=p}
    [5.10259]
    [5.87]
    drawing.pending = {mode=Current_drawing_mode, target_point=p, target_point_index=i}