Many improvements.
This commit is contained in:
14
third-party/mexui/Core/Control/Button.js
vendored
14
third-party/mexui/Core/Control/Button.js
vendored
@@ -11,7 +11,16 @@ mexui.util.linkBaseControlStyles('Button', {});
|
||||
// input
|
||||
mexui.Control.Button.prototype.onMouseDown = function(e)
|
||||
{
|
||||
if(this.isCursorOverControl())
|
||||
if(e.button == 0 && this.isCursorOverControl())
|
||||
{
|
||||
e.used = true;
|
||||
this.checkToCallCallback();
|
||||
}
|
||||
};
|
||||
|
||||
mexui.Control.Button.prototype.onKeyDown = function(e, key, mods)
|
||||
{
|
||||
if(this.isFocused() && (key == SDLK_RETURN || key == SDLK_RETURN2 || key == SDLK_KP_ENTER || key == SDLK_SPACE))
|
||||
{
|
||||
e.used = true;
|
||||
this.checkToCallCallback();
|
||||
@@ -25,4 +34,7 @@ mexui.Control.Button.prototype.render = function()
|
||||
|
||||
mexui.native.drawRectangle(pos, this.size, this.getStyles('main'));
|
||||
mexui.native.drawText(pos, this.size, this.text, this.getStyles('main'));
|
||||
|
||||
if(this.isFocused())
|
||||
mexui.native.drawRectangleBorder(mexui.util.subtractVec2(pos,new Vec2(2,2)), mexui.util.addVec2(this.size,new Vec2(3,3)), this.getStyles('focused'));
|
||||
};
|
||||
Reference in New Issue
Block a user