Skip to content

Commit

Permalink
Removed canvas color button from toolbar
Browse files Browse the repository at this point in the history
Moved it to Settings > Canvas color. This is now a global setting and not on a project/file basis anymore
  • Loading branch information
mbrlabs committed Nov 6, 2023
1 parent ce3614d commit da288cb
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 134 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ This will be the last "major" version using Godot 3. After this release i will s
- Improved translations: Spanish, Brasilian Portuguese
- Improved UI auto scaling, especially for Windows and OSX
- Moved to grid toggle button from the toolbar to the settings
- Removed the canvas background color from the toolbar and moved it to Settings > Canvas Color. The previous setting (Appearance > Default canvas color was removed)
- `.lorien` files do no longer store the canvas background color
- Updated to Godot 3.5.3

## [0.5.0] - 2022-06-12
Expand Down
2 changes: 1 addition & 1 deletion lorien/Assets/I18n/de.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ SETTINGS_APPEARANCE Ansicht
SETTINGS_RENDERING Rendering
SETTINGS_PRESSURE_SENSITIVITY Druckempfindlichkeit
SETTINGS_BRUSH_SIZE Default Pinsel Größe
SETTINGS_CANVAS_COLOR Default Canvas Farbe
SETTINGS_PROJECT_FOLDER Default Project Ordner
SETTINGS_LANGUAGE Sprache
SETTINGS_THEME Theme
SETTINGS_GRID_SIZE Grid Größe
SETTINGS_GRID_PATTERN Grid Pattern
SETTINGS_CANVAS_COLOR Canvas Farbe
SETTINGS_AA_METHOD Anti Aliasing Methode
SETTINGS_AA_METHOD_NONE Keine
SETTINGS_FPS_FOREGROUND Vordergrund Fps
Expand Down
2 changes: 1 addition & 1 deletion lorien/Assets/I18n/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ SETTINGS_RENDERING Rendering
SETTINGS_KEYBINDINGS Keybindings
SETTINGS_PRESSURE_SENSITIVITY Pressure Sensitivity
SETTINGS_BRUSH_SIZE Default Brush Size
SETTINGS_CANVAS_COLOR Default Canvas Color
SETTINGS_PROJECT_FOLDER Default Project Folder
SETTINGS_GRID_SIZE Grid Size
SETTINGS_LANGUAGE Language
Expand All @@ -72,6 +71,7 @@ SETTINGS_UI_SCALE_AUTO Auto
SETTINGS_UI_SCALE_CUSTOM Custom
SETTINGS_GRID_SIZE Grid Size
SETTINGS_GRID_PATTERN Grid Pattern
SETTINGS_CANVAS_COLOR Canvas Color
SETTINGS_AA_METHOD Anti Aliasing Method
SETTINGS_AA_METHOD_NONE None
SETTINGS_FPS_FOREGROUND Foreground Fps
Expand Down
2 changes: 1 addition & 1 deletion lorien/Assets/I18n/es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SETTINGS_APPEARANCE Apariencia
SETTINGS_RENDERING Renderizado
SETTINGS_PRESSURE_SENSITIVITY Sensibilidad de Presión
SETTINGS_BRUSH_SIZE Tamaño de Pincel Predeterminado
SETTINGS_CANVAS_COLOR Color de Canvas Predeterminado
SETTINGS_CANVAS_COLOR Color de Canvas
SETTINGS_PROJECT_FOLDER Carpeta de Proyectos Predeterminada
SETTINGS_LANGUAGE Idioma
SETTINGS_THEME Tema
Expand Down
2 changes: 1 addition & 1 deletion lorien/Assets/I18n/fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ SETTINGS_APPEARANCE Apparence
SETTINGS_RENDERING Affichage
SETTINGS_PRESSURE_SENSITIVITY Sensibilité de la pression
SETTINGS_BRUSH_SIZE Épaisseur par défaut de la brosse
SETTINGS_CANVAS_COLOR Couleur par défaut du canevas
SETTINGS_PROJECT_FOLDER Dossier par défaut du projet
SETTINGS_LANGUAGE Langue
SETTINGS_THEME Thème
SETTINGS_AA_METHOD Méthode d'anticrénelage
SETTINGS_AA_METHOD_NONE Aucun
SETTINGS_FPS_FOREGROUND Fps lorsque actif
SETTINGS_FPS_BACKGROUND Fps lorsque inactif
SETTINGS_CANVAS_COLOR Couleur du canevas
SETTINGS_BRUSH_CAPS Extrémités des tracés
SETTINGS_BRUSH_CAPS_FLAT Plates
SETTINGS_BRUSH_CAPS_ROUND Arrondies
Expand Down
5 changes: 2 additions & 3 deletions lorien/Assets/I18n/it.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ TOOLBAR_TOOLTIP_LINE_TOOL Strumento Linea {{ shortcut_list("shortcut_line_
TOOLBAR_TOOLTIP_ERASER_TOOL Gomma per cancellare {{ shortcut_list("shortcut_eraser_tool") }}
TOOLBAR_TOOLTIP_SELECT_TOOL Seleziona strumento {{ shortcut_list("shortcut_select_tool") }}
TOOLBAR_TOOLTIP_BRUSH_COLOR Colore Pennello
TOOLBAR_TOOLTIP_BRUSH_SIZE Dimensione del Pennello
TOOLBAR_TOOLTIP_CANVAS_COLOR Colore della Tela
TOOLBAR_TOOLTIP_BRUSH_SIZE Dimensione del Pennello
TOOLBAR_FULLSCREEN_TOGGLE Commuta la modalità a schermo intero

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -60,14 +59,14 @@ SETTINGS_APPEARANCE Aspetto
SETTINGS_RENDERING Rendering
SETTINGS_PRESSURE_SENSITIVITY Sensibilità alla pressione
SETTINGS_BRUSH_SIZE Dimensione Pennello Predefinita
SETTINGS_CANVAS_COLOR Colore Tela Predefinito
SETTINGS_PROJECT_FOLDER Cartella di Progetto Predefinita
SETTINGS_LANGUAGE Lingua
SETTINGS_THEME Tema
SETTINGS_AA_METHOD Metodo Anti-Aliasing
SETTINGS_AA_METHOD_NONE Nessuno
SETTINGS_FPS_FOREGROUND Fps in primo piano
SETTINGS_FPS_BACKGROUND Fps sullo sfondo
SETTINGS_CANVAS_COLOR Colore della Tela
SETTINGS_BRUSH_CAPS Modalità arrotondamento pennello
SETTINGS_BRUSH_CAPS_FLAT Piatto
SETTINGS_BRUSH_CAPS_ROUND Rotondo
Expand Down
3 changes: 1 addition & 2 deletions lorien/Assets/I18n/ko.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_ERASER_TOOL 지우개 {{ shortcut_list("shortcut_eraser_tool
TOOLBAR_TOOLTIP_SELECT_TOOL 범위 선택 {{ shortcut_list("shortcut_select_tool") }}
TOOLBAR_TOOLTIP_BRUSH_COLOR 브러쉬 색깔
TOOLBAR_TOOLTIP_BRUSH_SIZE 브러쉬 크기
TOOLBAR_TOOLTIP_CANVAS_COLOR 배경 색깔
TOOLBAR_FULLSCREEN_TOGGLE 전체화면/원래대로

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -61,7 +60,6 @@ SETTINGS_APPEARANCE 모양
SETTINGS_RENDERING 렌더링
SETTINGS_PRESSURE_SENSITIVITY 필압 민감도
SETTINGS_BRUSH_SIZE 기본 브러쉬 크기
SETTINGS_CANVAS_COLOR 기본 배경 색깔
SETTINGS_PROJECT_FOLDER 기본 프로젝트 풀더
SETTINGS_LANGUAGE 언어
SETTINGS_THEME 테마
Expand All @@ -72,6 +70,7 @@ SETTINGS_AA_METHOD 안티에일리어싱
SETTINGS_AA_METHOD_NONE 없음
SETTINGS_FPS_FOREGROUND 필기 프레임
SETTINGS_FPS_BACKGROUND 배경 프레임
SETTINGS_CANVAS_COLOR 배경 색깔
SETTINGS_BRUSH_CAPS 브러쉬 끝 부분 모양
SETTINGS_BRUSH_CAPS_FLAT 평평하게
SETTINGS_BRUSH_CAPS_ROUND 둥굴게
Expand Down
3 changes: 1 addition & 2 deletions lorien/Assets/I18n/pt-BR.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_ERASER_TOOL Borracha {{ shortcut_list("shortcut_eraser_tool"
TOOLBAR_TOOLTIP_SELECT_TOOL Ferramenta de Seleção {{ shortcut_list("shortcut_select_tool") }}
TOOLBAR_TOOLTIP_BRUSH_COLOR Cor do Pincel
TOOLBAR_TOOLTIP_BRUSH_SIZE Tamanho do Pincel
TOOLBAR_TOOLTIP_CANVAS_COLOR Cor da Área de Desenho
TOOLBAR_FULLSCREEN_TOGGLE (Des)ativar Tela Cheia

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -62,7 +61,7 @@ SETTINGS_RENDERING Renderização
SETTINGS_KEYBINDINGS Teclas de Atalho
SETTINGS_PRESSURE_SENSITIVITY Sensibilidade à Pressão
SETTINGS_BRUSH_SIZE Tamanho Padrão do Pincel
SETTINGS_CANVAS_COLOR Cor Padrão da Área de Desenho
SETTINGS_CANVAS_COLOR Cor da Área de Desenho
SETTINGS_PROJECT_FOLDER Pasta Padrão do Projeto
SETTINGS_LANGUAGE Idioma
SETTINGS_THEME Tema
Expand Down
3 changes: 1 addition & 2 deletions lorien/Assets/I18n/ru.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ TOOLBAR_TOOLTIP_RECTANGLE_TOOL Rectangle Tool {{ shortcut_list("shortcut_rectan
TOOLBAR_TOOLTIP_LINE_TOOL Линия {{ shortcut_list("shortcut_line_tool") }}
TOOLBAR_TOOLTIP_ERASER_TOOL Стерка {{ shortcut_list("shortcut_eraser_tool") }}
TOOLBAR_TOOLTIP_SELECT_TOOL Выделить {{ shortcut_list("shortcut_select_tool") }}
TOOLBAR_TOOLTIP_BRUSH_COLOR Цвет кисти
TOOLBAR_TOOLTIP_BRUSH_SIZE Размер кисти
TOOLBAR_TOOLTIP_CANVAS_COLOR Цвет холста

Expand Down Expand Up @@ -59,7 +58,7 @@ SETTINGS_APPEARANCE Внешний вид
SETTINGS_RENDERING Рендеринг
SETTINGS_PRESSURE_SENSITIVITY Pressure Sensitivity # TODO
SETTINGS_BRUSH_SIZE Размер кисти по умолчанию
SETTINGS_CANVAS_COLOR Цвет холста по умолчанию
SETTINGS_CANVAS_COLOR Цвет кисти
SETTINGS_PROJECT_FOLDER Папка проекта по умолчанию
SETTINGS_LANGUAGE Язык
SETTINGS_THEME Тема
Expand Down
3 changes: 1 addition & 2 deletions lorien/Assets/I18n/tr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_ERASER_TOOL Silgi {{ shortcut_list("shortcut_eraser_tool") }
TOOLBAR_TOOLTIP_SELECT_TOOL Seçim Aracı {{ shortcut_list("shortcut_select_tool") }}
TOOLBAR_TOOLTIP_BRUSH_COLOR Fırça Rengi
TOOLBAR_TOOLTIP_BRUSH_SIZE Fırça Boyutu
TOOLBAR_TOOLTIP_CANVAS_COLOR Tuval Rengi
TOOLBAR_FULLSCREEN_TOGGLE Tam Ekran

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -62,7 +61,7 @@ SETTINGS_RENDERING Rendering
SETTINGS_KEYBINDINGS Tuşlar
SETTINGS_PRESSURE_SENSITIVITY Basınç Hassaslığı
SETTINGS_BRUSH_SIZE Varsayılan Fırça Boyutu
SETTINGS_CANVAS_COLOR Varsayılan Tuval Rengi
SETTINGS_CANVAS_COLOR Tuval Rengi
SETTINGS_PROJECT_FOLDER Varsayılan Proje Klasörü
SETTINGS_GRID_SIZE Izgara Boyutu
SETTINGS_LANGUAGE Dil
Expand Down
3 changes: 1 addition & 2 deletions lorien/Assets/I18n/zh-CN.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_ERASER_TOOL 橡皮擦 {{ shortcut_list("shortcut_eraser_tool
TOOLBAR_TOOLTIP_SELECT_TOOL 选择工具 {{ shortcut_list("shortcut_select_tool") }}
TOOLBAR_TOOLTIP_BRUSH_COLOR 画笔颜色
TOOLBAR_TOOLTIP_BRUSH_SIZE 画笔大小
TOOLBAR_TOOLTIP_CANVAS_COLOR 画布颜色
TOOLBAR_FULLSCREEN_TOGGLE 切换全屏

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -61,7 +60,7 @@ SETTINGS_APPEARANCE 外观
SETTINGS_RENDERING 渲染
SETTINGS_PRESSURE_SENSITIVITY 压力敏感度
SETTINGS_BRUSH_SIZE 默认画笔大小
SETTINGS_CANVAS_COLOR 默认画布颜色
SETTINGS_CANVAS_COLOR 画布颜色
SETTINGS_PROJECT_FOLDER 默认项目路径
SETTINGS_LANGUAGE 语言
SETTINGS_THEME 主题
Expand Down
3 changes: 1 addition & 2 deletions lorien/Assets/I18n/zh-TW.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ TOOLBAR_TOOLTIP_ERASER_TOOL 橡皮擦 {{ shortcut_list("shortcut_eraser_tool
TOOLBAR_TOOLTIP_SELECT_TOOL 選擇工具 {{ shortcut_list("shortcut_select_tool") }}
TOOLBAR_TOOLTIP_BRUSH_COLOR 畫筆顏色
TOOLBAR_TOOLTIP_BRUSH_SIZE 畫筆大小
TOOLBAR_TOOLTIP_CANVAS_COLOR 畫布底色
TOOLBAR_FULLSCREEN_TOGGLE 全螢幕切換

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -61,7 +60,7 @@ SETTINGS_APPEARANCE 外觀
SETTINGS_RENDERING 渲染
SETTINGS_PRESSURE_SENSITIVITY 筆壓敏感度
SETTINGS_BRUSH_SIZE 預設畫筆大小
SETTINGS_CANVAS_COLOR 預設畫布底色
SETTINGS_CANVAS_COLOR 畫布底色
SETTINGS_PROJECT_FOLDER 預設專案目錄
SETTINGS_LANGUAGE 語言
SETTINGS_THEME 佈景主題
Expand Down
1 change: 1 addition & 0 deletions lorien/InfiniteCanvas/InfiniteCanvas.gd
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var _scale := Config.DEFAULT_UI_SCALE
func _ready():
_optimizer = BrushStrokeOptimizer.new()
_brush_size = Settings.get_value(Settings.GENERAL_DEFAULT_BRUSH_SIZE, Config.DEFAULT_BRUSH_SIZE)
set_background_color(Settings.get_value(Settings.APPEARANCE_CANVAS_COLOR, Config.DEFAULT_CANVAS_COLOR))
_active_tool._on_brush_size_changed(_brush_size)
_active_tool.enabled = false

Expand Down
1 change: 1 addition & 0 deletions lorien/InfiniteCanvas/InfiniteCanvasGrid.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func set_grid_pattern(pattern: int) -> void:
# -------------------------------------------------------------------------------------------------
func set_canvas_color(c: Color) -> void:
_grid_color = c * 1.25
update()

# -------------------------------------------------------------------------------------------------
func set_grid_scale(size: float):
Expand Down
16 changes: 6 additions & 10 deletions lorien/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func _ready():
OS.set_window_title("Lorien v%s" % Config.VERSION_STRING)
get_tree().set_auto_accept_quit(false)

_canvas.set_background_color(Config.DEFAULT_CANVAS_COLOR)
var docs_folder = OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS)
_file_dialog.current_dir = Settings.get_value(Settings.GENERAL_DEFAULT_PROJECT_DIR, docs_folder)
_export_dialog.current_dir = Settings.get_value(Settings.GENERAL_DEFAULT_PROJECT_DIR, docs_folder)
Expand All @@ -47,7 +46,6 @@ func _ready():
_toolbar.connect("new_project", self, "_on_create_new_project")
_toolbar.connect("save_project", self, "_on_save_project")
_toolbar.connect("brush_size_changed", self, "_on_brush_size_changed")
_toolbar.connect("canvas_background_changed", self, "_on_canvas_background_changed")
_toolbar.connect("tool_changed", self, "_on_tool_changed")

_menubar.connect("create_new_project", self, "_on_create_new_project")
Expand All @@ -72,6 +70,7 @@ func _ready():
_settings_dialog.connect("ui_scale_changed", self, "_on_scale_changed")
_settings_dialog.connect("grid_size_changed", self, "_on_grid_size_changed")
_settings_dialog.connect("grid_pattern_changed", self, "_on_grid_pattern_changed")
_settings_dialog.connect("canvas_color_changed", self, "_on_canvas_color_changed")

# Initialize scale
_on_scale_changed()
Expand Down Expand Up @@ -237,10 +236,6 @@ func _make_project_active(project: Project) -> void:
_menubar.make_tab(project)
_menubar.set_tab_active(project)

# TODO: find a better way to apply the color to the picker
var default_canvas_color = Config.DEFAULT_CANVAS_COLOR.to_html()
_background_color_picker.color = Color(project.meta_data.get(ProjectMetadata.CANVAS_COLOR, default_canvas_color))

# -------------------------------------------------------------------------------------------------
func _is_mouse_on_ui() -> bool:
var on_ui := Utils.is_mouse_in_control(_menubar)
Expand Down Expand Up @@ -339,6 +334,11 @@ func _on_grid_size_changed(size: int) -> void:
func _on_grid_pattern_changed(pattern: int) -> void:
_canvas_grid.set_grid_pattern(pattern)

# -------------------------------------------------------------------------------------------------
func _on_canvas_color_changed(color: Color) -> void:
_canvas.set_background_color(color)
_canvas_grid.set_canvas_color(color)

# -------------------------------------------------------------------------------------------------
func _on_clear_canvas() -> void:
_canvas.clear()
Expand Down Expand Up @@ -408,10 +408,6 @@ func _on_file_selected_to_save_project(filepath: String) -> void:
# -------------------------------------------------------------------------------------------------
func _on_canvas_background_changed(color: Color) -> void:
_canvas.set_background_color(color)
var project: Project = ProjectManager.get_active_project()
if project != null:
project.meta_data[ProjectMetadata.CANVAS_COLOR] = color.to_html()
project.dirty = true

# -------------------------------------------------------------------------------------------------
func _on_undo_action() -> void:
Expand Down
10 changes: 5 additions & 5 deletions lorien/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ margin_top = 38.0
margin_right = 1920.0
margin_bottom = 78.0
file_dialog_path = NodePath("../../FileDialog")
background_color_picker_path = NodePath("../../BackgroundColorPickerPopup/PanelContainer/ColorPicker")

[node name="Statusbar" parent="." instance=ExtResource( 3 )]
anchor_top = 1.0
Expand Down Expand Up @@ -92,10 +91,10 @@ margin_bottom = 202.0
custom_styles/panel = SubResource( 1 )

[node name="ColorPicker" type="ColorPicker" parent="BackgroundColorPickerPopup/PanelContainer"]
margin_left = 64.0
margin_top = 64.0
margin_right = 373.0
margin_bottom = 468.0
margin_left = 84.0
margin_top = 84.0
margin_right = 393.0
margin_bottom = 488.0
edit_alpha = false
presets_enabled = false
presets_visible = false
Expand Down Expand Up @@ -207,6 +206,7 @@ margin_bottom = 45.0
popup_exclusive = true

[node name="AboutDialog" parent="." instance=ExtResource( 9 )]
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
Expand Down
2 changes: 1 addition & 1 deletion lorien/Misc/Settings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ extends Node
const DEFAULT_SECTION := "settings"
const SHORTCUTS_SECTION := "shortcuts"
const GENERAL_PRESSURE_SENSITIVITY := "general_pressure_sensitvity"
const GENERAL_DEFAULT_CANVAS_COLOR := "general_default_canvas_color"
const GENERAL_DEFAULT_BRUSH_SIZE := "general_default_brush_size"
const GENERAL_DEFAULT_PROJECT_DIR := "general_default_project_dir"
const GENERAL_LANGUAGE := "general_language"
Expand All @@ -13,6 +12,7 @@ const APPEARANCE_UI_SCALE_MODE := "appearance_ui_scale_mode"
const APPEARANCE_UI_SCALE := "appearance_ui_scale"
const APPEARANCE_GRID_PATTERN := "appearance_grid_pattern"
const APPEARANCE_GRID_SIZE := "appearance_grid_size"
const APPEARANCE_CANVAS_COLOR := "appearance_canvas_color"
const RENDERING_AA_MODE := "rendering_aa_mode"
const RENDERING_FOREGROUND_FPS := "rendering_foreground_fps"
const RENDERING_BACKGROUND_FPS := "rendering_background_fps"
Expand Down
3 changes: 0 additions & 3 deletions lorien/ProjectManager/ProjectManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ func add_project(filepath: String = "") -> Project:
print_debug("Project already in open project list")
return p

var canvas_color: Color = Settings.get_value(Settings.GENERAL_DEFAULT_CANVAS_COLOR, Config.DEFAULT_CANVAS_COLOR)

var project := Project.new()
project.meta_data[ProjectMetadata.CANVAS_COLOR] = canvas_color.to_html(false)
project.id = _open_projects.size()
project.filepath = filepath
project.loaded = project.filepath.empty() # empty/unsaved/new projects are loaded by definition
Expand Down
10 changes: 0 additions & 10 deletions lorien/ProjectManager/ProjectMetadata.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ extends Node
const CAMERA_ZOOM := "camera_zoom"
const CAMERA_OFFSET_X := "camera_offset_x"
const CAMERA_OFFSET_Y := "camera_offset_y"
const CANVAS_COLOR := "canvas_color"

# -------------------------------------------------------------------------------------------------
func make_dict(canvas: InfiniteCanvas) -> Dictionary:
Expand All @@ -14,7 +13,6 @@ func make_dict(canvas: InfiniteCanvas) -> Dictionary:
CAMERA_OFFSET_X: str(cam.offset.x),
CAMERA_OFFSET_Y: str(cam.offset.y),
CAMERA_ZOOM: str(cam.zoom.x),
CANVAS_COLOR: canvas.get_background_color().to_html(false),
}

# -------------------------------------------------------------------------------------------------
Expand All @@ -24,14 +22,6 @@ func apply_from_dict(meta_data: Dictionary, canvas: InfiniteCanvas) -> void:
var new_cam_zoom_str: String = meta_data.get(CAMERA_ZOOM, "1.0")
var new_cam_offset_x_str: String = meta_data.get(CAMERA_OFFSET_X, "0.0")
var new_cam_offset_y_str: String = meta_data.get(CAMERA_OFFSET_Y, "0.0")
var new_canvas_color: String = meta_data.get(CANVAS_COLOR, Config.DEFAULT_CANVAS_COLOR.to_html())

cam.offset = Vector2(float(new_cam_offset_x_str), float(new_cam_offset_y_str))
cam.set_zoom_level(float(new_cam_zoom_str))
canvas.set_background_color(Color(new_canvas_color))

# -------------------------------------------------------------------------------------------------
func get_canvas_color_from_dict(meta_data: Dictionary) -> Color:
if meta_data.has(CANVAS_COLOR):
return Color(meta_data[CANVAS_COLOR])
return Config.DEFAULT_CANVAS_COLOR
Loading

0 comments on commit da288cb

Please sign in to comment.