|
404 | 404 |
|
405 | 405 | LineDrawer = defclass(LineDrawer, Shape)
|
406 | 406 |
|
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 |
| - |
436 | 407 | function LineDrawer:plot_bresenham(x0, y0, x1, y1, thickness)
|
437 | 408 | local dx = math.abs(x1 - x0)
|
438 | 409 | local dy = math.abs(y1 - y0)
|
@@ -472,7 +443,35 @@ function LineDrawer:plot_bresenham(x0, y0, x1, y1, thickness)
|
472 | 443 | p = p - 1
|
473 | 444 | end
|
474 | 445 | 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) |
475 | 469 |
|
| 470 | + end |
| 471 | + end, |
| 472 | + keys = { "CUSTOM_T", "CUSTOM_SHIFT_T" }, |
| 473 | + }, |
| 474 | + } |
476 | 475 | end
|
477 | 476 |
|
478 | 477 | local function get_granularity(x0, y0, x1, y1, bezier_point1, bezier_point2)
|
|
821 | 820 | -- module users can get shapes through this global, shape option values
|
822 | 821 | -- persist in these as long as the module is loaded
|
823 | 822 | -- 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