Expanded table functionality.

This commit is contained in:
mono 2022-01-01 13:18:55 +01:00
parent cf32f494ad
commit fd2204feb7
2 changed files with 22 additions and 3 deletions

View File

@ -25,3 +25,7 @@ func get_model() -> PackedScene:
if model == null:
model = _create_model()
return model
func get_allocation_size() -> int:
return 0

View File

@ -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()