diff --git a/addons/summer_day/data/blueprint/blueprint.gd b/addons/summer_day/data/blueprint/blueprint.gd index a713cac..e69fd1f 100644 --- a/addons/summer_day/data/blueprint/blueprint.gd +++ b/addons/summer_day/data/blueprint/blueprint.gd @@ -25,3 +25,7 @@ func get_model() -> PackedScene: if model == null: model = _create_model() return model + + +func get_allocation_size() -> int: + return 0 diff --git a/addons/summer_day/data/document/table.gd b/addons/summer_day/data/document/table.gd index a614c65..7546513 100644 --- a/addons/summer_day/data/document/table.gd +++ b/addons/summer_day/data/document/table.gd @@ -15,9 +15,7 @@ func create(): image.create(row_size, 1, false, Image.FORMAT_RGBAF) texture.create_from_image(image, 0) _presage_changes() - for i in range(row_size): - image.set_pixel(i, 0, - Color(1.0, 0.0, 0.0)) + image.fill(Color.red) flush() @@ -32,6 +30,23 @@ func apply_matrix(matrix: SummerDayMatrix4, row: int, position: int): ) +func add_row(): + _presage_changes() + image.crop(image.get_width(), image.get_height() + 1) + + +func remove_row(at: int): + _presage_changes() + var size = image.get_size() + var below_height = size.y - 1 + if at < below_height: + image.blit_rect(image, + Rect2(Vector2(0, at + 1), Vector2(size.x, below_height - at)), + Vector2(Vector2(0, at)) + ) + image.crop(size.x, below_height) + + func flush(): if dirty_flag: image.unlock()