2020-04-24 21:42:02 +00:00
|
|
|
extends TextureButton
|
|
|
|
|
|
|
|
|
|
|
|
var image : Image
|
2020-04-24 23:09:34 +00:00
|
|
|
var image_size : Vector2
|
2020-04-24 21:42:02 +00:00
|
|
|
var texture : ImageTexture
|
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
if image:
|
2020-04-24 23:09:34 +00:00
|
|
|
image_size = image.get_size()
|
2020-04-24 21:42:02 +00:00
|
|
|
texture = ImageTexture.new()
|
|
|
|
texture.create_from_image(image, 0)
|
|
|
|
|
|
|
|
|
|
|
|
func _on_PatternButton_pressed() -> void:
|
|
|
|
if Global.pattern_window_position == "left":
|
|
|
|
Global.pattern_left_image = image
|
|
|
|
Global.left_fill_pattern_container.get_child(0).get_child(0).texture = texture
|
2020-04-24 23:09:34 +00:00
|
|
|
Global.left_fill_pattern_container.get_child(2).get_child(1).max_value = image_size.x - 1
|
|
|
|
Global.left_fill_pattern_container.get_child(3).get_child(1).max_value = image_size.y - 1
|
2020-04-24 21:42:02 +00:00
|
|
|
|
|
|
|
elif Global.pattern_window_position == "right":
|
|
|
|
Global.pattern_right_image = image
|
|
|
|
Global.right_fill_pattern_container.get_child(0).get_child(0).texture = texture
|
2020-04-24 23:09:34 +00:00
|
|
|
Global.right_fill_pattern_container.get_child(2).get_child(1).max_value = image_size.x - 1
|
|
|
|
Global.right_fill_pattern_container.get_child(3).get_child(1).max_value = image_size.y - 1
|
|
|
|
|
2020-04-24 21:42:02 +00:00
|
|
|
Global.patterns_popup.hide()
|