summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-09-02 11:55:12 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-09-02 12:03:49 -0300
commitb78067930237ade5a8942b41dc4aea08b827cde2 (patch)
tree1d4c668736bfc35332756a5077d65d2db9e9e26d /scene/gui
parent8216bec7d1adf123e76e5feb8d72ac176e94d537 (diff)
-Added focus to comment node
-Make comment node not grab focus on main area
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/graph_node.cpp31
-rw-r--r--scene/gui/graph_node.h3
2 files changed, 33 insertions, 1 deletions
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 5ece970936..da298a795a 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -183,12 +183,39 @@ void GraphNode::_resort() {
}
+bool GraphNode::has_point(const Point2& p_point) const {
+
+ if (comment) {
+ Ref<StyleBox> comment = get_stylebox("comment");
+ Ref<Texture> resizer =get_icon("resizer");
+
+ if (Rect2(get_size()-resizer->get_size(), resizer->get_size()).has_point(p_point)) {
+ return true;
+ }
+ if (Rect2(0,0,get_size().width,comment->get_margin(MARGIN_TOP)).has_point(p_point)) {
+ return true;
+ }
+
+ return false;
+
+ } else {
+ return Control::has_point(p_point);
+ }
+}
void GraphNode::_notification(int p_what) {
if (p_what==NOTIFICATION_DRAW) {
- Ref<StyleBox> sb=get_stylebox(comment? "comment": (selected ? "selectedframe" : "frame"));
+ Ref<StyleBox> sb;
+
+ if (comment) {
+ sb = get_stylebox( selected? "commentfocus" : "comment");
+
+ } else {
+
+ sb = get_stylebox( selected ? "selectedframe" : "frame");
+ }
sb=sb->duplicate();
sb->call("set_modulate",modulate);
@@ -601,6 +628,8 @@ void GraphNode::_input_event(const InputEvent& p_ev) {
ERR_EXPLAIN("GraphNode must be the child of a GraphEdit node.");
ERR_FAIL_COND(get_parent_control() == NULL);
+ print_line("INPUT EVENT BUTTON");
+
if(p_ev.mouse_button.pressed && p_ev.mouse_button.button_index==BUTTON_LEFT) {
Vector2 mpos = Vector2(p_ev.mouse_button.x,p_ev.mouse_button.y);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index 7357ab5a45..cbfd34f556 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -93,6 +93,9 @@ private:
Overlay overlay;
Color modulate;
+
+ bool has_point(const Point2& p_point) const;
+
protected: