Skip to content

Commit fdd597e

Browse files
committed
light cleanup
1 parent 0f8985b commit fdd597e

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

gui/design.lua

+2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,10 @@ function Design:init()
342342
local DESIGN_CHAR_WIDTH = 8
343343
local DESIGN_CHAR_HEIGHT = 12
344344
local shape_tileset = dfhack.textures.loadTileset('hack/data/art/design.png', DESIGN_CHAR_WIDTH, DESIGN_CHAR_HEIGHT, true)
345+
345346
local STRIDE = DESIGN_ICONS_WIDTH / DESIGN_CHAR_WIDTH
346347
local CHARS_PER_ROW = DESIGN_ICONS_HEIGHT / (DESIGN_ICON_ROW_COUNT * DESIGN_CHAR_HEIGHT)
348+
347349
local shape_options, shape_button_specs, shape_button_specs_selected = {}, {}, {}
348350
for _, shape in ipairs(shapes.all_shapes) do
349351
table.insert(shape_options, {label=shape.name, value=shape})

internal/design/shapes.lua

+29-30
Original file line numberDiff line numberDiff line change
@@ -404,35 +404,6 @@ end
404404

405405
LineDrawer = defclass(LineDrawer, Shape)
406406

407-
Line = defclass(Line, LineDrawer)
408-
Line.ATTRS {
409-
name = "Line",
410-
extra_points = { { label = "Curve Point" }, { label = "Second Curve Point" } },
411-
invertable = false, -- Doesn't support invert
412-
basic_shape = false, -- Driven by points, not rectangle bounds
413-
texture_offset = 17,
414-
button_chars = util.make_ascii_button(250, '(')
415-
}
416-
417-
function Line:init()
418-
self.options = {
419-
thickness = {
420-
name = "Line thickness",
421-
type = "plusminus",
422-
value = 1,
423-
min = 1,
424-
max = function(shape) if not shape.height or not shape.width then
425-
return nil
426-
else
427-
return math.max(shape.height, shape.width)
428-
429-
end
430-
end,
431-
keys = { "CUSTOM_T", "CUSTOM_SHIFT_T" },
432-
},
433-
}
434-
end
435-
436407
function LineDrawer:plot_bresenham(x0, y0, x1, y1, thickness)
437408
local dx = math.abs(x1 - x0)
438409
local dy = math.abs(y1 - y0)
@@ -472,7 +443,35 @@ function LineDrawer:plot_bresenham(x0, y0, x1, y1, thickness)
472443
p = p - 1
473444
end
474445
end
446+
end
447+
448+
Line = defclass(Line, LineDrawer)
449+
Line.ATTRS {
450+
name = "Line",
451+
extra_points = { { label = "Curve Point" }, { label = "Second Curve Point" } },
452+
invertable = false, -- Doesn't support invert
453+
basic_shape = false, -- Driven by points, not rectangle bounds
454+
texture_offset = 17,
455+
button_chars = util.make_ascii_button(250, '(')
456+
}
457+
458+
function Line:init()
459+
self.options = {
460+
thickness = {
461+
name = "Line thickness",
462+
type = "plusminus",
463+
value = 1,
464+
min = 1,
465+
max = function(shape) if not shape.height or not shape.width then
466+
return nil
467+
else
468+
return math.max(shape.height, shape.width)
475469

470+
end
471+
end,
472+
keys = { "CUSTOM_T", "CUSTOM_SHIFT_T" },
473+
},
474+
}
476475
end
477476

478477
local function get_granularity(x0, y0, x1, y1, bezier_point1, bezier_point2)
@@ -821,4 +820,4 @@ end
821820
-- module users can get shapes through this global, shape option values
822821
-- persist in these as long as the module is loaded
823822
-- idk enough lua to know if this is okay to do or not
824-
all_shapes = { Rectangle {}, Ellipse {}, Rows {}, Diag {}, Line {}, FreeForm {}, Star {} }
823+
all_shapes = { Rectangle {}, Ellipse {}, Star {}, Rows {}, Diag {}, Line {}, FreeForm {} }

0 commit comments

Comments
 (0)