input boxes UI, keyboard animation
This commit is contained in:
@@ -7,9 +7,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
|
#import "GameViewController.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
@interface AppDelegate ()
|
@interface AppDelegate () {
|
||||||
|
GameViewController* view;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -18,17 +21,21 @@
|
|||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
|
view = (GameViewController*)self.window.rootViewController;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||||
|
App::I.redraw = true;
|
||||||
|
[view reset_touch];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||||
|
App::I.redraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||||
@@ -43,6 +50,7 @@
|
|||||||
|
|
||||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||||
|
App::I.redraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -11,4 +11,6 @@
|
|||||||
|
|
||||||
@interface GameViewController : GLKViewController <UIKeyInput>
|
@interface GameViewController : GLKViewController <UIKeyInput>
|
||||||
|
|
||||||
|
- (void)reset_touch;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
//std::map<
|
//std::map<
|
||||||
int t_count = 0;
|
int t_count = 0;
|
||||||
|
glm::vec2 t_pos;
|
||||||
|
|
||||||
@implementation GameViewController
|
@implementation GameViewController
|
||||||
|
|
||||||
@@ -49,11 +50,27 @@ int t_count = 0;
|
|||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(keyboardWasShown:)
|
selector:@selector(keyboardWasShown:)
|
||||||
name:UIKeyboardWillShowNotification object:nil];
|
name:UIKeyboardWillShowNotification object:nil];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
selector:@selector(keyboardWillBeHidden:)
|
selector:@selector(keyboardWillBeHidden:)
|
||||||
name:UIKeyboardWillHideNotification object:nil];
|
name:UIKeyboardWillHideNotification object:nil];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(keyboardWillBeShown:)
|
||||||
|
name:UIKeyboardDidShowNotification object:nil];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(keyboardWasHidden:)
|
||||||
|
name:UIKeyboardDidHideNotification object:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)keyboardWillBeShown:(NSNotification*)aNotification
|
||||||
|
{
|
||||||
|
App::I.redraw = true;
|
||||||
|
App::I.animate = true;
|
||||||
|
}
|
||||||
|
- (void)keyboardWasHidden:(NSNotification*)aNotification
|
||||||
|
{
|
||||||
|
App::I.redraw = true;
|
||||||
|
App::I.animate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the UIKeyboardDidShowNotification is sent.
|
// Called when the UIKeyboardDidShowNotification is sent.
|
||||||
@@ -66,8 +83,10 @@ int t_count = 0;
|
|||||||
CGRect frame = view.frame;
|
CGRect frame = view.frame;
|
||||||
frame.size.height -= kbSize.height;
|
frame.size.height -= kbSize.height;
|
||||||
view.frame = frame;
|
view.frame = frame;
|
||||||
|
|
||||||
App::I.resize(frame.size.width * view.contentScaleFactor,
|
App::I.resize(frame.size.width * view.contentScaleFactor,
|
||||||
frame.size.height * view.contentScaleFactor);
|
frame.size.height * view.contentScaleFactor);
|
||||||
|
App::I.animate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the UIKeyboardWillHideNotification is sent
|
// Called when the UIKeyboardWillHideNotification is sent
|
||||||
@@ -77,6 +96,16 @@ int t_count = 0;
|
|||||||
self.view.frame = frame;
|
self.view.frame = frame;
|
||||||
App::I.resize(frame.size.width * self.view.contentScaleFactor,
|
App::I.resize(frame.size.width * self.view.contentScaleFactor,
|
||||||
frame.size.height * self.view.contentScaleFactor);
|
frame.size.height * self.view.contentScaleFactor);
|
||||||
|
App::I.animate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)reset_touch
|
||||||
|
{
|
||||||
|
if (t_count == 2)
|
||||||
|
App::I.gesture_end();
|
||||||
|
else
|
||||||
|
App::I.mouse_cancel(0);
|
||||||
|
t_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
||||||
@@ -88,6 +117,7 @@ int t_count = 0;
|
|||||||
|
|
||||||
App::I.mouse_down(0, touchLocation.x * scale, touchLocation.y * scale, touch.force);
|
App::I.mouse_down(0, touchLocation.x * scale, touchLocation.y * scale, touch.force);
|
||||||
t_count = 1;
|
t_count = 1;
|
||||||
|
t_pos = {touchLocation.x * scale, touchLocation.y * scale};
|
||||||
}
|
}
|
||||||
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
||||||
{
|
{
|
||||||
@@ -135,6 +165,7 @@ int t_count = 0;
|
|||||||
App::I.mouse_move(touchLocation.x * scale, touchLocation.y * scale, force);
|
App::I.mouse_move(touchLocation.x * scale, touchLocation.y * scale, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
t_pos = {tl0.x * scale, tl0.y * scale};
|
||||||
}
|
}
|
||||||
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
|
||||||
{
|
{
|
||||||
@@ -147,6 +178,7 @@ int t_count = 0;
|
|||||||
else
|
else
|
||||||
App::I.mouse_up(0, touchLocation.x * scale, touchLocation.y * scale);
|
App::I.mouse_up(0, touchLocation.x * scale, touchLocation.y * scale);
|
||||||
t_count = 0;
|
t_count = 0;
|
||||||
|
t_pos = {touchLocation.x * scale, touchLocation.y * scale};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
||||||
@@ -236,7 +268,7 @@ int t_count = 0;
|
|||||||
|
|
||||||
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
|
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
|
||||||
{
|
{
|
||||||
if (!App::I.redraw)
|
if (!(App::I.redraw || App::I.animate))
|
||||||
return;
|
return;
|
||||||
App::I.clear();
|
App::I.clear();
|
||||||
App::I.update(0);
|
App::I.update(0);
|
||||||
|
|||||||
@@ -173,10 +173,10 @@
|
|||||||
<text text="Rename Layer" font-face="arial" font-size="11"></text>
|
<text text="Rename Layer" font-face="arial" font-size="11"></text>
|
||||||
</border>
|
</border>
|
||||||
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
||||||
<node dir="row">
|
<border dir="row" align="center" height="30" color=".2 .2 .2 1">
|
||||||
<text text="New name: " font-face="arial" font-size="11"/>
|
<text text="New name: " font-face="arial" font-size="11" margin="0 5 0 5"/>
|
||||||
<text-input id="txt-input" width="100" height="20" color=".3"/>
|
<text-input id="txt-input" justify="center" pad="5" grow="1" height="30" color=".3"/>
|
||||||
</node>
|
</border>
|
||||||
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
||||||
<button id="btn-ok" text="Rename Layer" width="100" height="30" margin="0 10 0 0"/>
|
<button id="btn-ok" text="Rename Layer" width="100" height="30" margin="0 10 0 0"/>
|
||||||
<button id="btn-cancel" text="Cancel" width="60" height="30" pad="10"/>
|
<button id="btn-cancel" text="Cancel" width="60" height="30" pad="10"/>
|
||||||
@@ -187,7 +187,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
|
|
||||||
<layout id="dialog-open-item">
|
<layout id="dialog-open-item">
|
||||||
<border dir="row" color=".4 .4 .4 .8" pad="4">
|
<border dir="row" color=".4 .4 .4 .8" pad="4" height="30" margin="1 0 1 0" align="center">
|
||||||
<!--<image-texture id="thumb-tex" width="64" height="64"/>-->
|
<!--<image-texture id="thumb-tex" width="64" height="64"/>-->
|
||||||
<text id="title" text="Title" font-face="arial" font-size="11"/>
|
<text id="title" text="Title" font-face="arial" font-size="11"/>
|
||||||
</border>
|
</border>
|
||||||
@@ -202,12 +202,14 @@
|
|||||||
</border>
|
</border>
|
||||||
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
||||||
<node dir="row">
|
<node dir="row">
|
||||||
<node id="files-list" dir="col"/>
|
<scroll id="files-list" dir="col" flood-events="1" grow="1" height="150" margin="0 10 0 0" pad="0 20 0 0" color=".2 .2 .2 1"/>
|
||||||
|
<!--
|
||||||
<node dir="col" grow="1" margin="0 0 0 10">
|
<node dir="col" grow="1" margin="0 0 0 10">
|
||||||
<border height="20" align="center" justify="center" color=".2 .2 .2 1"><text id="info-title" text="Title" font-face="arial" font-size="11"/></border>
|
<border height="20" align="center" justify="center" color=".2 .2 .2 1"><text id="info-title" text="Title" font-face="arial" font-size="11"/></border>
|
||||||
<text id="info-data" text="Title" font-face="arial" font-size="11"/>
|
<text id="info-data" text="Title" font-face="arial" font-size="11"/>
|
||||||
</node>
|
</node>
|
||||||
<image-texture id="thumb-tex" width="100" height="100"/>
|
-->
|
||||||
|
<image-texture id="thumb-tex" aspect-ratio="1" width="150" height="150"/>
|
||||||
</node>
|
</node>
|
||||||
<!--<text-input width="100" height="100" color=".3"/>-->
|
<!--<text-input width="100" height="100" color=".3"/>-->
|
||||||
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
||||||
@@ -227,10 +229,10 @@
|
|||||||
<text text="Save Pano Project" font-face="arial" font-size="11"></text>
|
<text text="Save Pano Project" font-face="arial" font-size="11"></text>
|
||||||
</border>
|
</border>
|
||||||
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
||||||
<node dir="row">
|
<border dir="row" align="center" height="30" color=".2 .2 .2 1">
|
||||||
<text text="Project name: " font-face="arial" font-size="11"/>
|
<text text="Project name: " font-face="arial" font-size="11" margin="0 5 0 5"/>
|
||||||
<text-input id="txt-input" width="100" height="20" color=".3"/>
|
<text-input id="txt-input" justify="center" pad="5" grow="1" height="30" color=".3"/>
|
||||||
</node>
|
</border>
|
||||||
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
||||||
<button id="btn-ok" text="Save Project" width="100" height="30" margin="0 10 0 0"/>
|
<button id="btn-ok" text="Save Project" width="100" height="30" margin="0 10 0 0"/>
|
||||||
<button id="btn-cancel" text="Cancel" width="60" height="30" pad="10"/>
|
<button id="btn-cancel" text="Cancel" width="60" height="30" pad="10"/>
|
||||||
@@ -250,7 +252,7 @@
|
|||||||
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
<border width="400" color="0 0 0 .9" pad="10" dir="col">
|
||||||
<border dir="row" align="center" height="30" color=".2 .2 .2 1">
|
<border dir="row" align="center" height="30" color=".2 .2 .2 1">
|
||||||
<text text="Project name: " font-face="arial" font-size="11" margin="0 5 0 5"/>
|
<text text="Project name: " font-face="arial" font-size="11" margin="0 5 0 5"/>
|
||||||
<text-input id="txt-input" grow="1" height="30" color=".3"/>
|
<text-input id="txt-input" justify="center" pad="5" grow="1" height="30" color=".3"/>
|
||||||
</border>
|
</border>
|
||||||
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
<node height="40" grow="1" dir="row" align="flex-end" justify="flex-end">
|
||||||
<button id="btn-ok" text="Create Project" width="100" height="30" margin="0 10 0 0"/>
|
<button id="btn-ok" text="Create Project" width="100" height="30" margin="0 10 0 0"/>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void App::update(float dt)
|
|||||||
if (canvas && canvas->m_canvas)
|
if (canvas && canvas->m_canvas)
|
||||||
canvas->m_canvas->stroke_draw();
|
canvas->m_canvas->stroke_draw();
|
||||||
|
|
||||||
if (!redraw)
|
if (!(redraw || animate))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//glClearColor(.1f, .1f, .1f, 1.f);
|
//glClearColor(.1f, .1f, .1f, 1.f);
|
||||||
@@ -146,7 +146,8 @@ void App::update(float dt)
|
|||||||
if (n && n->m_display)
|
if (n && n->m_display)
|
||||||
{
|
{
|
||||||
auto box = n->m_clip;
|
auto box = n->m_clip;
|
||||||
glm::ivec4 c = glm::vec4((int)box.x - 1, (int)(height / zoom - box.y - box.w) - 1, (int)box.z + 2, (int)box.w + 2) * zoom;
|
//glm::ivec4 c = glm::vec4((int)box.x - 1, (int)(height / zoom - box.y - box.w) - 1, (int)box.z + 2, (int)box.w + 2) * zoom;
|
||||||
|
glm::ivec4 c = glm::vec4((int)box.x, (int)(height / zoom - box.y - box.w), (int)box.z, (int)box.w) * zoom;
|
||||||
glScissor(c.x, c.y, c.z, c.w);
|
glScissor(c.x, c.y, c.z, c.w);
|
||||||
n->draw();
|
n->draw();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public:
|
|||||||
float height;
|
float height;
|
||||||
bool keys[256];
|
bool keys[256];
|
||||||
bool redraw = true;
|
bool redraw = true;
|
||||||
|
bool animate = false;
|
||||||
glm::vec2 gesture_p0;
|
glm::vec2 gesture_p0;
|
||||||
glm::vec2 gesture_p1;
|
glm::vec2 gesture_p1;
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
@@ -101,4 +102,5 @@ public:
|
|||||||
void dialog_save();
|
void dialog_save();
|
||||||
void dialog_open();
|
void dialog_open();
|
||||||
void dialog_export();
|
void dialog_export();
|
||||||
|
void dialog_layer_rename();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,22 +11,35 @@ void App::dialog_newdoc()
|
|||||||
dialog->init();
|
dialog->init();
|
||||||
dialog->create();
|
dialog->create();
|
||||||
dialog->loaded();
|
dialog->loaded();
|
||||||
dialog->input->set_text("");
|
dialog->input->set_text("name");
|
||||||
|
|
||||||
layout[main_id]->add_child(dialog);
|
layout[main_id]->add_child(dialog);
|
||||||
layout[main_id]->update();
|
layout[main_id]->update();
|
||||||
|
|
||||||
|
App::I.showKeyboard();
|
||||||
|
|
||||||
dialog->btn_ok->on_click = [this, dialog](Node*)
|
dialog->btn_ok->on_click = [this, dialog](Node*)
|
||||||
{
|
{
|
||||||
doc_name = dialog->input->m_string;
|
doc_name = dialog->input->m_string;
|
||||||
if (auto docname = layout[main_id]->find<NodeText>("txt-docname"))
|
if (auto docname = layout[main_id]->find<NodeText>("txt-docname"))
|
||||||
docname->set_text(("Panodoc: " + doc_name).c_str());
|
docname->set_text(("Panodoc: " + doc_name).c_str());
|
||||||
|
|
||||||
layers->clear();
|
layers->clear();
|
||||||
canvas->m_canvas->m_layers.clear();
|
canvas->m_canvas->m_layers.clear();
|
||||||
canvas->m_canvas->m_order.clear();
|
canvas->m_canvas->m_order.clear();
|
||||||
canvas->reset_camera();
|
canvas->reset_camera();
|
||||||
ActionManager::clear();
|
ActionManager::clear();
|
||||||
|
|
||||||
|
canvas->m_canvas->layer_add("Default");
|
||||||
|
layers->add_layer("Default");
|
||||||
|
|
||||||
dialog->destroy();
|
dialog->destroy();
|
||||||
|
App::I.hideKeyboard();
|
||||||
|
};
|
||||||
|
dialog->btn_cancel->on_click = [this, dialog](Node*)
|
||||||
|
{
|
||||||
|
dialog->destroy();
|
||||||
|
App::I.hideKeyboard();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,6 +86,8 @@ void App::dialog_save()
|
|||||||
dialog->loaded();
|
dialog->loaded();
|
||||||
dialog->input->set_text(doc_name);
|
dialog->input->set_text(doc_name);
|
||||||
|
|
||||||
|
App::I.showKeyboard();
|
||||||
|
|
||||||
layout[main_id]->add_child(dialog);
|
layout[main_id]->add_child(dialog);
|
||||||
layout[main_id]->update();
|
layout[main_id]->update();
|
||||||
|
|
||||||
@@ -83,6 +98,12 @@ void App::dialog_save()
|
|||||||
docname->set_text(("Panodoc: " + doc_name).c_str());
|
docname->set_text(("Panodoc: " + doc_name).c_str());
|
||||||
canvas->m_canvas->project_save(data_path + "/" + doc_name + ".pano");
|
canvas->m_canvas->project_save(data_path + "/" + doc_name + ".pano");
|
||||||
dialog->destroy();
|
dialog->destroy();
|
||||||
|
App::I.hideKeyboard();
|
||||||
|
};
|
||||||
|
dialog->btn_cancel->on_click = [this, dialog](Node*)
|
||||||
|
{
|
||||||
|
dialog->destroy();
|
||||||
|
App::I.hideKeyboard();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,3 +115,35 @@ void App::dialog_export()
|
|||||||
canvas->m_canvas->export_equirectangular(data_path);
|
canvas->m_canvas->export_equirectangular(data_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void App::dialog_layer_rename()
|
||||||
|
{
|
||||||
|
auto dialog = std::make_shared<NodeDialogLayerRename>();
|
||||||
|
dialog->m_manager = &layout;
|
||||||
|
dialog->data_path = data_path;
|
||||||
|
dialog->init();
|
||||||
|
dialog->create();
|
||||||
|
dialog->loaded();
|
||||||
|
dialog->input->set_text(layers->m_current_layer->m_label_text);
|
||||||
|
|
||||||
|
App::I.showKeyboard();
|
||||||
|
|
||||||
|
layout[main_id]->add_child(dialog);
|
||||||
|
layout[main_id]->update();
|
||||||
|
|
||||||
|
dialog->btn_ok->on_click = [this,dialog](Node*)
|
||||||
|
{
|
||||||
|
layers->m_current_layer->set_name(dialog->get_name().c_str());
|
||||||
|
canvas->m_canvas->m_layers[canvas->m_canvas->m_current_layer_idx].m_name = dialog->get_name();
|
||||||
|
dialog->destroy();
|
||||||
|
App::I.hideKeyboard();
|
||||||
|
};
|
||||||
|
dialog->btn_cancel->on_click = [this, dialog](Node*)
|
||||||
|
{
|
||||||
|
dialog->destroy();
|
||||||
|
App::I.hideKeyboard();
|
||||||
|
};
|
||||||
|
|
||||||
|
popup->mouse_release();
|
||||||
|
popup->destroy();
|
||||||
|
}
|
||||||
|
|||||||
@@ -390,25 +390,7 @@ void App::init_menu_layer()
|
|||||||
};
|
};
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("layer-rename")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("layer-rename")->on_click = [this](Node*) {
|
||||||
auto open_dialog = std::make_shared<NodeDialogLayerRename>();
|
dialog_layer_rename();
|
||||||
open_dialog->m_manager = &layout;
|
|
||||||
open_dialog->data_path = data_path;
|
|
||||||
open_dialog->init();
|
|
||||||
open_dialog->create();
|
|
||||||
open_dialog->loaded();
|
|
||||||
|
|
||||||
layout[main_id]->add_child(open_dialog);
|
|
||||||
layout[main_id]->update();
|
|
||||||
|
|
||||||
open_dialog->btn_ok->on_click = [this,open_dialog](Node*)
|
|
||||||
{
|
|
||||||
layers->m_current_layer->set_name(open_dialog->get_name().c_str());
|
|
||||||
canvas->m_canvas->m_layers[canvas->m_canvas->m_current_layer_idx].m_name = open_dialog->get_name();
|
|
||||||
open_dialog->destroy();
|
|
||||||
};
|
|
||||||
|
|
||||||
popup->mouse_release();
|
|
||||||
popup->destroy();
|
|
||||||
};
|
};
|
||||||
if (layers->m_current_layer)
|
if (layers->m_current_layer)
|
||||||
popup->find<NodeButtonCustom>("layer-rename")->
|
popup->find<NodeButtonCustom>("layer-rename")->
|
||||||
@@ -482,6 +464,7 @@ void App::initLayout()
|
|||||||
|
|
||||||
canvas->m_canvas->layer_add("Default");
|
canvas->m_canvas->layer_add("Default");
|
||||||
layers->add_layer("Default");
|
layers->add_layer("Default");
|
||||||
|
|
||||||
init_toolbar_draw();
|
init_toolbar_draw();
|
||||||
init_toolbar_main();
|
init_toolbar_main();
|
||||||
init_menu_file();
|
init_menu_file();
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj)
|
|||||||
float pl = 0;//YGNodeLayoutGetPadding(parent->y_node, YGEdgeLeft);
|
float pl = 0;//YGNodeLayoutGetPadding(parent->y_node, YGEdgeLeft);
|
||||||
glm::vec2 off_p(pl, pt);
|
glm::vec2 off_p(pl, pt);
|
||||||
glm::vec2 off_s(pr, pb);
|
glm::vec2 off_s(pr, pb);
|
||||||
m_clip_uncut = glm::vec4(m_pos - off_p, m_size + off_p + off_s);
|
m_clip_uncut = glm::vec4(m_pos - off_p - glm::vec2(1), m_size + off_p + off_s + glm::vec2(2));
|
||||||
m_clip = rect_intersection(m_clip_uncut, parent->m_clip);
|
m_clip = rect_intersection(m_clip_uncut, parent->m_clip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ kEventResult NodeButton::handle_event(Event* e)
|
|||||||
if (m_mouse_inside && on_click != nullptr)
|
if (m_mouse_inside && on_click != nullptr)
|
||||||
on_click(this);
|
on_click(this);
|
||||||
break;
|
break;
|
||||||
|
case kEventType::MouseCancel:
|
||||||
|
m_border->m_color = color_normal;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return kEventResult::Available;
|
return kEventResult::Available;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -49,12 +49,17 @@ kEventResult NodeButtonCustom::handle_event(Event* e)
|
|||||||
mouse_capture();
|
mouse_capture();
|
||||||
break;
|
break;
|
||||||
case kEventType::MouseUpL:
|
case kEventType::MouseUpL:
|
||||||
|
#ifdef __IOS__
|
||||||
|
m_color = color_normal;
|
||||||
|
#else
|
||||||
m_color = m_mouse_inside ? color_hover : color_normal;
|
m_color = m_mouse_inside ? color_hover : color_normal;
|
||||||
|
#endif
|
||||||
if (m_mouse_inside && on_click != nullptr)
|
if (m_mouse_inside && on_click != nullptr)
|
||||||
on_click(this);
|
on_click(this);
|
||||||
mouse_release();
|
mouse_release();
|
||||||
break;
|
break;
|
||||||
case kEventType::MouseCancel:
|
case kEventType::MouseCancel:
|
||||||
|
m_color = color_normal;
|
||||||
mouse_release();
|
mouse_release();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ void NodeDialogOpenItem::loaded()
|
|||||||
void NodeDialogOpenItem::draw()
|
void NodeDialogOpenItem::draw()
|
||||||
{
|
{
|
||||||
auto c = m_selected ? m_color_selected : m_color_normal;
|
auto c = m_selected ? m_color_selected : m_color_normal;
|
||||||
//m_thinkness = m_selected ? 1.f : 0.f;
|
m_thinkness = m_selected ? 1.f : 0.f;
|
||||||
m_color = m_mouse_inside ? m_color_hover : c;
|
m_color = m_mouse_inside ? m_color_hover : c;
|
||||||
NodeBorder::draw();
|
NodeBorder::draw();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user