Explorar el Código

Revert "fixes #934"

This reverts commit 335763da4c
tags/v0.3.1
Big Bad Waffle hace 5 años
padre
commit
40cf6b3ccb
Se han modificado 2 ficheros con 12 adiciones y 17 borrados
  1. +10
    -10
      helpers/passives/client/ui/uiBase.js
  2. +2
    -7
      src/client/ui/uiBase.js

+ 10
- 10
helpers/passives/client/ui/uiBase.js Ver fichero

@@ -14,7 +14,7 @@ define([
eventCallbacks: {}, eventCallbacks: {},


render: function () { render: function () {
let container = '.ui-container';
var container = '.ui-container';
if (this.container) if (this.container)
container += ' > ' + this.container; container += ' > ' + this.container;


@@ -50,13 +50,13 @@ define([
}, },


on: function (el, event, callback) { on: function (el, event, callback) {
if (typeof (el) === 'string')
if (typeof (el) == 'string')
el = this.find(el); el = this.find(el);
else else
el = $(el); el = $(el);


el.on(event, function (e) { el.on(event, function (e) {
let args = [].slice.call(arguments, 1);
var args = [].slice.call(arguments, 1);
args.splice(0, 0, event); args.splice(0, 0, event);


callback.apply(null, [...args, e]); callback.apply(null, [...args, e]);
@@ -76,11 +76,11 @@ define([
this.centeredX = x; this.centeredX = x;
this.centeredY = y; this.centeredY = y;


let el = this.el;
let pat = el.parent();
var el = this.el;
var pat = el.parent();


let posX = ~~((pat.width() / 2) - (el.width() / 2)) - 10;
let posY = ~~((pat.height() / 2) - (el.height() / 2)) - 10;
var posX = ~~((pat.width() / 2) - (el.width() / 2)) - 10;
var posY = ~~((pat.height() / 2) - (el.height() / 2)) - 10;


el.css('position', 'absolute'); el.css('position', 'absolute');
if (x) if (x)
@@ -119,15 +119,15 @@ define([
}, },


setDisabled: function (isDisabled) { setDisabled: function (isDisabled) {
this.el.removeClass('disabled');
this.el.removeClass('disabled')


if (isDisabled) if (isDisabled)
this.el.addClass('disabled'); this.el.addClass('disabled');
}, },


onEvent: function (event, callback) { onEvent: function (event, callback) {
let list = this.eventCallbacks[event] || (this.eventCallbacks[event] = []);
let eventCallback = events.on(event, callback);
var list = this.eventCallbacks[event] || (this.eventCallbacks[event] = []);
var eventCallback = events.on(event, callback);
list.push(eventCallback); list.push(eventCallback);


return eventCallback; return eventCallback;


+ 2
- 7
src/client/ui/uiBase.js Ver fichero

@@ -89,13 +89,8 @@ define([
el.css('top', posY); el.css('top', posY);
}, },
show: function () { show: function () {
if (this.modal) {
$('.modal').toArray().forEach(u => {
let ui = $(u).data('ui');
if (ui.shown)
ui.hide();
});
}
if (this.modal)
$('.modal').hide();


this.shown = true; this.shown = true;
this.el.show(); this.el.show();


Cargando…
Cancelar
Guardar