1
0
Fork 0

Canvas GUI: don't drag window on close button.

This commit is contained in:
Thomas Geymayer 2013-06-29 14:43:06 +02:00
parent ace3182f87
commit eaf4c60cfb
2 changed files with 12 additions and 1 deletions

View file

@ -142,6 +142,13 @@ var Element = {
_node: props.wrapNode(ghost._node_ghost)
};
},
# Check if elements represent same instance
#
# @param el Other Element or element ghost
equals: func(el)
{
return me._node.equals(el._node_ghost);
},
# Trigger an update of the element
#
# Elements are automatically updated once a frame, with a delay of one frame.

View file

@ -165,7 +165,6 @@ var Window = {
var group_deco = canvas_deco.getGroup("decoration");
var title_bar = group_deco.createChild("group", "title_bar");
title_bar.addEventListener("drag", func(e) { me.move(e.deltaX, e.deltaY); });
title_bar
.rect( 0, 0,
me.get("size[0]"),
@ -200,5 +199,10 @@ var Window = {
var title = me.get("title", "Canvas Dialog");
me._node.getNode("title", 1).alias(me._title._node.getPath() ~ "/text");
me.set("title", title);
title_bar.addEventListener("drag", func(e) {
if( !ico.equals(e.target) )
me.move(e.deltaX, e.deltaY);
});
}
};