Separating safe window area from window area
This commit is contained in:
parent
97d299a346
commit
b1f6f04d37
18 changed files with 121 additions and 102 deletions
|
|
@ -203,9 +203,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EMSCRIPTEN)
|
if(NOT EMSCRIPTEN)
|
||||||
if(ANDROID)
|
if(NOT ANDROID)
|
||||||
find_package(game-text-input REQUIRED CONFIG)
|
|
||||||
else()
|
|
||||||
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
|
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared)
|
||||||
endif()
|
endif()
|
||||||
find_package(LibDataChannel REQUIRED)
|
find_package(LibDataChannel REQUIRED)
|
||||||
|
|
@ -384,7 +382,7 @@ if(NO_CONAN_BUILD)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(main skia-infinipaint::skia-infinipaint)
|
target_link_libraries(main skia-infinipaint::skia-infinipaint)
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
target_link_libraries(main SDL3::SDL3 game-text-input::game-text-input)
|
target_link_libraries(main SDL3::SDL3)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(main sdl-infinipaint::sdl-infinipaint)
|
target_link_libraries(main sdl-infinipaint::sdl-infinipaint)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,8 @@
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="android:Theme.NoTitleBar.Fullscreen">
|
<style name="AppTheme" parent="android:Theme.NoTitleBar.Fullscreen">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">true</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -438,36 +438,59 @@ void DrawingProgram::selection_action_menu(Vector2f popupPos) {
|
||||||
|
|
||||||
GUIStuff::GUIManager& gui = world.main.g.gui;
|
GUIStuff::GUIManager& gui = world.main.g.gui;
|
||||||
|
|
||||||
|
right_click_action_menu(popupPos, [&] {
|
||||||
|
text_label_light(gui, "Selection menu");
|
||||||
|
popup_menu_action_button("Paste", "Paste", [&, popupPos] {
|
||||||
|
selection.deselect_all();
|
||||||
|
selection.paste_clipboard(popupPos * world.main.g.final_gui_scale());
|
||||||
|
});
|
||||||
|
popup_menu_action_button("Paste Image", "Paste Image", [&, popupPos] {
|
||||||
|
selection.deselect_all();
|
||||||
|
world.main.input.call_paste(CustomEvents::PasteEvent::DataType::IMAGE, {
|
||||||
|
.pastePosition = popupPos * world.main.g.final_gui_scale()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if(selection.is_something_selected()) {
|
||||||
|
popup_menu_action_button("Copy", "Copy", [&] {
|
||||||
|
selection.selection_to_clipboard();
|
||||||
|
});
|
||||||
|
popup_menu_action_button("Cut", "Cut", [&] {
|
||||||
|
selection.selection_to_clipboard();
|
||||||
|
selection.delete_all();
|
||||||
|
});
|
||||||
|
popup_menu_action_button("Delete", "Delete", [&] {
|
||||||
|
selection.delete_all();
|
||||||
|
});
|
||||||
|
popup_menu_action_button("Bring to front of layer", "Bring to front of layer", [&] {
|
||||||
|
selection.push_selection_to_front();
|
||||||
|
});
|
||||||
|
popup_menu_action_button("Send to back of layer", "Send to back of layer", [&] {
|
||||||
|
selection.push_selection_to_back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawingProgram::right_click_action_menu(Vector2f popupPos, const std::function<void()>& innerContent) {
|
||||||
|
using namespace GUIStuff;
|
||||||
|
using namespace ElementHelpers;
|
||||||
|
|
||||||
|
GUIStuff::GUIManager& gui = world.main.g.gui;
|
||||||
|
|
||||||
gui.set_z_index(-1, [&] {
|
gui.set_z_index(-1, [&] {
|
||||||
gui.element<PositionAdjustingPopupMenu>("Selection popup menu", popupPos, [&] {
|
gui.element<PositionAdjustingPopupMenu>("Selection popup menu", popupPos, [&] {
|
||||||
text_label_light(gui, "Selection menu");
|
CLAY_AUTO_ID({
|
||||||
popup_menu_action_button("Paste", "Paste", [&, popupPos] {
|
.layout = {
|
||||||
selection.deselect_all();
|
.sizing = {.width = CLAY_SIZING_FIT(100), .height = CLAY_SIZING_FIT(0)},
|
||||||
selection.paste_clipboard(popupPos * world.main.g.final_gui_scale());
|
.padding = CLAY_PADDING_ALL(gui.io.theme->padding1),
|
||||||
});
|
.childGap = 1,
|
||||||
popup_menu_action_button("Paste Image", "Paste Image", [&, popupPos] {
|
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP},
|
||||||
selection.deselect_all();
|
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||||
world.main.input.call_paste(CustomEvents::PasteEvent::DataType::IMAGE, {
|
},
|
||||||
.pastePosition = popupPos * world.main.g.final_gui_scale()
|
.backgroundColor = convert_vec4<Clay_Color>(gui.io.theme->backColor1),
|
||||||
});
|
.cornerRadius = CLAY_CORNER_RADIUS(gui.io.theme->windowCorners1)
|
||||||
});
|
}) {
|
||||||
if(selection.is_something_selected()) {
|
innerContent();
|
||||||
popup_menu_action_button("Copy", "Copy", [&] {
|
|
||||||
selection.selection_to_clipboard();
|
|
||||||
});
|
|
||||||
popup_menu_action_button("Cut", "Cut", [&] {
|
|
||||||
selection.selection_to_clipboard();
|
|
||||||
selection.delete_all();
|
|
||||||
});
|
|
||||||
popup_menu_action_button("Delete", "Delete", [&] {
|
|
||||||
selection.delete_all();
|
|
||||||
});
|
|
||||||
popup_menu_action_button("Bring to front of layer", "Bring to front of layer", [&] {
|
|
||||||
selection.push_selection_to_front();
|
|
||||||
});
|
|
||||||
popup_menu_action_button("Send to back of layer", "Send to back of layer", [&] {
|
|
||||||
selection.push_selection_to_back();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, LayoutElement::Callbacks{
|
}, LayoutElement::Callbacks{
|
||||||
.mouseButton = [&](LayoutElement* l, const InputManager::MouseButtonCallbackArgs& button) {
|
.mouseButton = [&](LayoutElement* l, const InputManager::MouseButtonCallbackArgs& button) {
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ class DrawingProgram {
|
||||||
void update_downloading_dropped_files();
|
void update_downloading_dropped_files();
|
||||||
|
|
||||||
void selection_action_menu(Vector2f popupPos);
|
void selection_action_menu(Vector2f popupPos);
|
||||||
|
void right_click_action_menu(Vector2f popupPos, const std::function<void()>& innerContent);
|
||||||
void popup_menu_action_button(const char* id, const char* text, const std::function<void()>& onClick);
|
void popup_menu_action_button(const char* id, const char* text, const std::function<void()>& onClick);
|
||||||
void rebuild_cache();
|
void rebuild_cache();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -282,34 +282,27 @@ void TextBoxEditTool::right_click_popup_gui(Toolbar& t, Vector2f popupPos) {
|
||||||
auto& gui = drawP.world.main.g.gui;
|
auto& gui = drawP.world.main.g.gui;
|
||||||
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
|
auto& a = static_cast<TextBoxCanvasComponent&>(comp->obj->get_comp());
|
||||||
|
|
||||||
gui.set_z_index(-1, [&] {
|
drawP.right_click_action_menu(popupPos, [&] {
|
||||||
gui.element<PositionAdjustingPopupMenu>("Text popup menu", popupPos, [&] {
|
text_label_light(gui, "Text menu");
|
||||||
text_label_light(gui, "Text menu");
|
InputManager& input = drawP.world.main.input;
|
||||||
InputManager& input = drawP.world.main.input;
|
drawP.popup_menu_action_button("Paste", "Paste", [&] {
|
||||||
drawP.popup_menu_action_button("Paste", "Paste", [&] {
|
drawP.world.main.input.call_paste(CustomEvents::PasteEvent::DataType::TEXT, { .allowRichText = true });
|
||||||
drawP.world.main.input.call_paste(CustomEvents::PasteEvent::DataType::TEXT, { .allowRichText = true });
|
|
||||||
});
|
|
||||||
drawP.popup_menu_action_button("Paste without formatting", "Paste without formatting", [&] {
|
|
||||||
drawP.world.main.input.call_paste(CustomEvents::PasteEvent::DataType::TEXT, { .allowRichText = false });
|
|
||||||
});
|
|
||||||
if(a.cursor->selectionBeginPos != a.cursor->selectionEndPos) {
|
|
||||||
drawP.popup_menu_action_button("Copy", "Copy", [&] {
|
|
||||||
input.set_clipboard_plain_and_richtext_pair(a.textBox->process_copy(*a.cursor));
|
|
||||||
});
|
|
||||||
drawP.popup_menu_action_button("Cut", "Cut", [&] {
|
|
||||||
userInput->do_textbox_operation_with_undo([&]() {
|
|
||||||
input.set_clipboard_plain_and_richtext_pair(a.textBox->process_cut(*a.cursor));
|
|
||||||
});
|
|
||||||
commit_update_and_layout_func();
|
|
||||||
set_styles_at_selection(a);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, LayoutElement::Callbacks{
|
|
||||||
.mouseButton = [&](LayoutElement*, const InputManager::MouseButtonCallbackArgs& button) {
|
|
||||||
if(button.down && button.button != InputManager::MouseButton::RIGHT)
|
|
||||||
drawP.clear_right_click_popup();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
drawP.popup_menu_action_button("Paste without formatting", "Paste without formatting", [&] {
|
||||||
|
drawP.world.main.input.call_paste(CustomEvents::PasteEvent::DataType::TEXT, { .allowRichText = false });
|
||||||
|
});
|
||||||
|
if(a.cursor->selectionBeginPos != a.cursor->selectionEndPos) {
|
||||||
|
drawP.popup_menu_action_button("Copy", "Copy", [&] {
|
||||||
|
input.set_clipboard_plain_and_richtext_pair(a.textBox->process_copy(*a.cursor));
|
||||||
|
});
|
||||||
|
drawP.popup_menu_action_button("Cut", "Cut", [&] {
|
||||||
|
userInput->do_textbox_operation_with_undo([&]() {
|
||||||
|
input.set_clipboard_plain_and_richtext_pair(a.textBox->process_cut(*a.cursor));
|
||||||
|
});
|
||||||
|
commit_update_and_layout_func();
|
||||||
|
set_styles_at_selection(a);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ void GUIHolder::update() {
|
||||||
|
|
||||||
void GUIHolder::window_update() {
|
void GUIHolder::window_update() {
|
||||||
calculate_final_gui_scale();
|
calculate_final_gui_scale();
|
||||||
gui.update_window(main.window.safeArea.min, main.window.safeArea.dim(), final_gui_scale());
|
gui.update_window(main.window.size.cast<float>(), main.window.safeArea, final_gui_scale());
|
||||||
}
|
}
|
||||||
|
|
||||||
float GUIHolder::final_gui_scale() {
|
float GUIHolder::final_gui_scale() {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#include <include/core/SkPath.h>
|
#include <include/core/SkPath.h>
|
||||||
#include <include/core/SkPathBuilder.h>
|
#include <include/core/SkPathBuilder.h>
|
||||||
#include "../GUIManager.hpp"
|
#include "../GUIManager.hpp"
|
||||||
|
#include "../../TimePoint.hpp"
|
||||||
|
|
||||||
namespace GUIStuff {
|
namespace GUIStuff {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Helpers/ConvertVec.hpp"
|
#include "Helpers/ConvertVec.hpp"
|
||||||
#include <include/core/SkCanvas.h>
|
#include <include/core/SkCanvas.h>
|
||||||
#include "../../TimePoint.hpp"
|
|
||||||
#include <Eigen/Dense>
|
#include <Eigen/Dense>
|
||||||
#include <include/core/SkFont.h>
|
#include <include/core/SkFont.h>
|
||||||
#include <include/core/SkFontMgr.h>
|
#include <include/core/SkFontMgr.h>
|
||||||
|
|
@ -12,7 +11,6 @@
|
||||||
#include <Helpers/SCollision.hpp>
|
#include <Helpers/SCollision.hpp>
|
||||||
#include <Helpers/Serializers.hpp>
|
#include <Helpers/Serializers.hpp>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include "../../RichText/TextBox.hpp"
|
|
||||||
#include "../../InputManager.hpp"
|
#include "../../InputManager.hpp"
|
||||||
#include "../GUIManagerID.hpp"
|
#include "../GUIManagerID.hpp"
|
||||||
|
|
||||||
|
|
@ -108,8 +106,8 @@ struct UpdateInputData {
|
||||||
float deltaTime = 0.0f;
|
float deltaTime = 0.0f;
|
||||||
|
|
||||||
float guiScaleMultiplier = 1.0f;
|
float guiScaleMultiplier = 1.0f;
|
||||||
Vector2f windowPos = {0.0f, 0.0f};
|
|
||||||
Vector2f windowSize = {0.0f, 0.0f};
|
Vector2f windowSize = {0.0f, 0.0f};
|
||||||
|
SCollision::AABB<float> safeWindowRect;
|
||||||
|
|
||||||
std::shared_ptr<FontData> fonts;
|
std::shared_ptr<FontData> fonts;
|
||||||
sk_sp<SkTypeface> textTypeface;
|
sk_sp<SkTypeface> textTypeface;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ void PositionAdjustingPopupMenu::layout(const Clay_ElementId& id, Vector2f popup
|
||||||
auto& bb = layoutElement->get_bb().value();
|
auto& bb = layoutElement->get_bb().value();
|
||||||
if((popupPos.y() + bb.height()) > gui.io.windowSize.y())
|
if((popupPos.y() + bb.height()) > gui.io.windowSize.y())
|
||||||
popupPos.y() -= bb.height();
|
popupPos.y() -= bb.height();
|
||||||
if((popupPos.x() + bb.width()) > gui.io.windowSize.x())
|
if((popupPos.x() + bb.width()) > gui.io.windowSize.y())
|
||||||
popupPos.x() -= bb.width();
|
popupPos.x() -= bb.width();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "RadioButton.hpp"
|
#include "RadioButton.hpp"
|
||||||
#include "../GUIManager.hpp"
|
#include "../GUIManager.hpp"
|
||||||
|
#include "../../TimePoint.hpp"
|
||||||
|
|
||||||
namespace GUIStuff {
|
namespace GUIStuff {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ template <typename T> void TextBox<T>::clay_draw(SkCanvas* canvas, UpdateInputDa
|
||||||
|
|
||||||
template <typename T> void TextBox<T>::select() {
|
template <typename T> void TextBox<T>::select() {
|
||||||
if(!is_selected()) {
|
if(!is_selected()) {
|
||||||
SCollision::AABB<float> rect = {(boundingBox.value().min + gui.io.windowPos) * gui.io.guiScaleMultiplier, (boundingBox.value().max + gui.io.windowPos) * gui.io.guiScaleMultiplier};
|
SCollision::AABB<float> rect = {boundingBox.value().min * gui.io.guiScaleMultiplier, boundingBox.value().max * gui.io.guiScaleMultiplier};
|
||||||
unsigned id = gui.io.input->set_text_box_front(rect, userInfo.textInputProps);
|
unsigned id = gui.io.input->set_text_box_front(rect, userInfo.textInputProps);
|
||||||
edit = TextEditData(id, textbox, cur);
|
edit = TextEditData(id, textbox, cur);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,8 @@ void GUIManager::clip_rect_transform(SkCanvas* canvas, std::vector<SCollision::A
|
||||||
SCollision::AABB<float> c = clipRect.value();
|
SCollision::AABB<float> c = clipRect.value();
|
||||||
c.min *= io.guiScaleMultiplier;
|
c.min *= io.guiScaleMultiplier;
|
||||||
c.max *= io.guiScaleMultiplier;
|
c.max *= io.guiScaleMultiplier;
|
||||||
c.min += io.windowPos;
|
|
||||||
c.max += io.windowPos;
|
|
||||||
canvas->clipIRect(c.get_sk_irect());
|
canvas->clipIRect(c.get_sk_irect());
|
||||||
}
|
}
|
||||||
canvas->translate(io.windowPos.x(), io.windowPos.y());
|
|
||||||
canvas->scale(io.guiScaleMultiplier, io.guiScaleMultiplier);
|
canvas->scale(io.guiScaleMultiplier, io.guiScaleMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -286,7 +283,6 @@ void GUIManager::draw(SkCanvas* c, bool skiaAA) {
|
||||||
|
|
||||||
void GUIManager::draw_force(SkCanvas* canvas, bool skiaAA) {
|
void GUIManager::draw_force(SkCanvas* canvas, bool skiaAA) {
|
||||||
canvas->save();
|
canvas->save();
|
||||||
canvas->translate(io.windowPos.x(), io.windowPos.y());
|
|
||||||
canvas->scale(io.guiScaleMultiplier, io.guiScaleMultiplier);
|
canvas->scale(io.guiScaleMultiplier, io.guiScaleMultiplier);
|
||||||
|
|
||||||
for(size_t i = 0; i < static_cast<size_t>(renderCommands.length); i++) {
|
for(size_t i = 0; i < static_cast<size_t>(renderCommands.length); i++) {
|
||||||
|
|
@ -521,13 +517,15 @@ GUIFloatAnimation* GUIManager::float_animation(const char* animationID, const GU
|
||||||
return toRet;
|
return toRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIManager::update_window(const Vector2f& windowPos, const Vector2f& windowSize, float guiScaleMultiplier) {
|
void GUIManager::update_window(const Vector2f& windowSize, const SCollision::AABB<float>& safeWindowRect, float guiScaleMultiplier) {
|
||||||
if(io.windowPos != windowPos || io.windowSize != windowSize || io.guiScaleMultiplier != guiScaleMultiplier) {
|
if(io.windowSize != windowSize || io.safeWindowRect != safeWindowRect || io.guiScaleMultiplier != guiScaleMultiplier) {
|
||||||
io.redrawSurface = true;
|
io.redrawSurface = true;
|
||||||
set_to_layout();
|
set_to_layout();
|
||||||
}
|
}
|
||||||
io.windowPos = windowPos;
|
|
||||||
io.windowSize = windowSize / guiScaleMultiplier;
|
io.windowSize = windowSize / guiScaleMultiplier;
|
||||||
|
io.safeWindowRect = safeWindowRect;
|
||||||
|
io.safeWindowRect.min /= guiScaleMultiplier;
|
||||||
|
io.safeWindowRect.max /= guiScaleMultiplier;
|
||||||
io.guiScaleMultiplier = guiScaleMultiplier;
|
io.guiScaleMultiplier = guiScaleMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -692,19 +690,16 @@ void GUIManager::input_key_callback(const InputManager::KeyCallbackArgs& key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIManager::input_mouse_button_callback(InputManager::MouseButtonCallbackArgs button) {
|
void GUIManager::input_mouse_button_callback(InputManager::MouseButtonCallbackArgs button) {
|
||||||
button.pos -= io.windowPos;
|
|
||||||
button.pos /= io.guiScaleMultiplier;
|
button.pos /= io.guiScaleMultiplier;
|
||||||
mouse_callback(button.pos, [&button] (ElementContainer* e) { e->elem->input_mouse_button_callback(button); });
|
mouse_callback(button.pos, [&button] (ElementContainer* e) { e->elem->input_mouse_button_callback(button); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIManager::input_mouse_motion_callback(InputManager::MouseMotionCallbackArgs motion) {
|
void GUIManager::input_mouse_motion_callback(InputManager::MouseMotionCallbackArgs motion) {
|
||||||
motion.pos -= io.windowPos;
|
|
||||||
motion.pos /= io.guiScaleMultiplier;
|
motion.pos /= io.guiScaleMultiplier;
|
||||||
mouse_callback(motion.pos, [&motion] (ElementContainer* e) { e->elem->input_mouse_motion_callback(motion); });
|
mouse_callback(motion.pos, [&motion] (ElementContainer* e) { e->elem->input_mouse_motion_callback(motion); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIManager::input_mouse_wheel_callback(InputManager::MouseWheelCallbackArgs wheel) {
|
void GUIManager::input_mouse_wheel_callback(InputManager::MouseWheelCallbackArgs wheel) {
|
||||||
wheel.mousePos -= io.windowPos;
|
|
||||||
wheel.mousePos /= io.guiScaleMultiplier;
|
wheel.mousePos /= io.guiScaleMultiplier;
|
||||||
mouse_callback(wheel.mousePos, [&wheel] (ElementContainer* e) { e->elem->input_mouse_wheel_callback(wheel); });
|
mouse_callback(wheel.mousePos, [&wheel] (ElementContainer* e) { e->elem->input_mouse_wheel_callback(wheel); });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class GUIManager {
|
||||||
GUIFloatAnimation* float_animation(const char* animationID, const GUIFloatAnimationData& animation);
|
GUIFloatAnimation* float_animation(const char* animationID, const GUIFloatAnimationData& animation);
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void update_window(const Vector2f& windowPos, const Vector2f& windowSize, float guiScaleMultiplier);
|
void update_window(const Vector2f& windowRect, const SCollision::AABB<float>& safeWindowRect, float guiScaleMultiplier);
|
||||||
|
|
||||||
UpdateInputData io;
|
UpdateInputData io;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ void FileSelectScreen::main_display() {
|
||||||
main_menu();
|
main_menu();
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_FIXED(gui.io.windowSize.x()), .height = CLAY_SIZING_GROW(0)},
|
.sizing = {.width = CLAY_SIZING_FIXED(gui.io.safeWindowRect.width()), .height = CLAY_SIZING_GROW(0)},
|
||||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP },
|
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP },
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
.layoutDirection = CLAY_TOP_TO_BOTTOM,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,35 +22,39 @@ void PhoneDrawingProgramScreen::gui_layout_run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneDrawingProgramScreen::main_display() {
|
void PhoneDrawingProgramScreen::main_display() {
|
||||||
auto& gui = main.g.gui;
|
|
||||||
auto& io = gui.io;
|
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) },
|
.sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) },
|
||||||
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
.layoutDirection = CLAY_TOP_TO_BOTTOM
|
||||||
},
|
},
|
||||||
}) {
|
}) {
|
||||||
gui.element<LayoutElement>("top toolbar", [&](LayoutElement* l, const Clay_ElementId& lId) {
|
top_toolbar();
|
||||||
CLAY(lId, {
|
|
||||||
.layout = {
|
|
||||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
|
|
||||||
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER},
|
|
||||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
|
||||||
},
|
|
||||||
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor0),
|
|
||||||
.border = {
|
|
||||||
.color = convert_vec4<Clay_Color>(io.theme->frontColor1),
|
|
||||||
.width = {.bottom = 1}
|
|
||||||
}
|
|
||||||
}) {
|
|
||||||
svg_icon_button(gui, "back exit button", "data/icons/RemixIcon/arrow-left-s-line.svg", {
|
|
||||||
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
|
||||||
.onClick = [&] {
|
|
||||||
main.set_tab_to_close(main.world.get());
|
|
||||||
main.screen = std::make_unique<FileSelectScreen>(main);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhoneDrawingProgramScreen::top_toolbar() {
|
||||||
|
auto& gui = main.g.gui;
|
||||||
|
auto& io = gui.io;
|
||||||
|
gui.element<LayoutElement>("top toolbar", [&](LayoutElement* l, const Clay_ElementId& lId) {
|
||||||
|
CLAY(lId, {
|
||||||
|
.layout = {
|
||||||
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
|
||||||
|
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER},
|
||||||
|
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||||
|
},
|
||||||
|
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor0),
|
||||||
|
.border = {
|
||||||
|
.color = convert_vec4<Clay_Color>(io.theme->frontColor1),
|
||||||
|
.width = {.bottom = 1}
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
svg_icon_button(gui, "back exit button", "data/icons/RemixIcon/arrow-left-s-line.svg", {
|
||||||
|
.drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
|
||||||
|
.onClick = [&] {
|
||||||
|
main.set_tab_to_close(main.world.get());
|
||||||
|
main.screen = std::make_unique<FileSelectScreen>(main);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,6 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
|
||||||
virtual void update() override;
|
virtual void update() override;
|
||||||
virtual void gui_layout_run() override;
|
virtual void gui_layout_run() override;
|
||||||
private:
|
private:
|
||||||
|
void top_toolbar();
|
||||||
void main_display();
|
void main_display();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ void Toolbar::layout_run() {
|
||||||
if(drawGui) {
|
if(drawGui) {
|
||||||
CLAY_AUTO_ID({
|
CLAY_AUTO_ID({
|
||||||
.layout = {
|
.layout = {
|
||||||
.sizing = {.width = CLAY_SIZING_FIT(gui.io.windowSize.x()), .height = CLAY_SIZING_FIT(gui.io.windowSize.y())},
|
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)},
|
||||||
.padding = CLAY_PADDING_ALL(io.theme->padding1),
|
.padding = CLAY_PADDING_ALL(io.theme->padding1),
|
||||||
.childGap = io.theme->childGap1,
|
.childGap = io.theme->childGap1,
|
||||||
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP},
|
.childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_TOP},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "GUIStuff/Elements/ScrollArea.hpp"
|
#include "GUIStuff/Elements/ScrollArea.hpp"
|
||||||
#include "DrawData.hpp"
|
#include "DrawData.hpp"
|
||||||
|
#include "TimePoint.hpp"
|
||||||
#include "Helpers/FileDownloader.hpp"
|
#include "Helpers/FileDownloader.hpp"
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <modules/skparagraph/include/Paragraph.h>
|
#include <modules/skparagraph/include/Paragraph.h>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue