improve Window GUI API

This commit is contained in:
Dany LE
2021-10-24 00:27:17 +02:00
parent aab242c1f7
commit 52709d5da4
5 changed files with 5417 additions and 5420 deletions

View File

@ -992,15 +992,9 @@ namespace OS {
// desktop[0].set "selected", -1
$(desktop).on("click", function (e) {
let el = $(e.target).parent();
if (!(el.length > 0)) {
return;
}
el = el.parent();
if (!(el.length > 0)) {
return;
}
if (el[0] !== desktop) {
let el = $(e.target).closest("afx-app-window")[0];
if(el)
{
return;
}
desktop.unselect();

View File

@ -108,7 +108,7 @@ namespace OS {
* @protected
* @memberof WindowTag
*/
protected calibrate(): void {}
protected calibrate(): void { }
/**
* Do nothing
@ -117,7 +117,7 @@ namespace OS {
* @param {*} [d]
* @memberof WindowTag
*/
protected reload(d?: any): void {}
protected reload(d?: any): void { }
/**
* Setter: Set the window width
@ -245,18 +245,18 @@ namespace OS {
* @memberof WindowTag
*/
protected mount(): void {
this.contextmenuHandle = function (e) {};
$(this.refs["minbt"]).on("click",(e) => {
this.contextmenuHandle = function (e) { };
$(this.refs["minbt"]).on("click", (e) => {
return this.observable.trigger("hide", {
id: this.aid,
});
});
$(this.refs["maxbt"]).on("click",(e) => {
$(this.refs["maxbt"]).on("click", (e) => {
return this.toggle_window();
});
$(this.refs["closebt"]).on("click",(e) => {
$(this.refs["closebt"]).on("click", (e) => {
return this.observable.trigger("exit", {
id: this.aid,
});
@ -276,8 +276,8 @@ namespace OS {
id: this.aid,
});
});
$(this.refs["dragger"]).on("dblclick",(e) => {
//$(this.refs.win_overlay).css("background-color", "red");
$(this.refs["dragger"]).on("dblclick", (e) => {
return this.toggle_window();
});
@ -290,11 +290,13 @@ namespace OS {
.css("z-index", Ant.OS.GUI.zindex)
.removeClass("unactive");
this._shown = true;
$(this.refs.win_overlay).hide();
});
this.observable.on("blur", () => {
this._shown = false;
return $(this).addClass("unactive");
$(this).addClass("unactive");
$(this.refs.win_overlay).show();
});
this.observable.on("hide", () => {
$(this).hide();
@ -408,12 +410,10 @@ namespace OS {
let w = $(this).width();
let h = $(this).height();
$(this.refs.win_overlay).show();
if(target != this.refs.grip_bottom)
{
w += e.clientX - offset.left;
if (target != this.refs.grip_bottom) {
w += e.clientX - offset.left;
}
if(target != this.refs.grip_right)
{
if (target != this.refs.grip_right) {
h += e.clientY - offset.top;
}
w = w < 100 ? 100 : w;