mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 09:48:21 +01:00
improve Window GUI API
This commit is contained in:
parent
aab242c1f7
commit
52709d5da4
29
Makefile
29
Makefile
@ -4,6 +4,9 @@ BUILDDIR?=/opt/www/htdocs/os
|
|||||||
DOCDIR?=/opt/www/htdocs/doc/antos
|
DOCDIR?=/opt/www/htdocs/doc/antos
|
||||||
BLUE=\033[1;34m
|
BLUE=\033[1;34m
|
||||||
NC=\033[0m
|
NC=\033[0m
|
||||||
|
TSC=./node_modules/typescript/bin/tsc
|
||||||
|
UGLIFYJS=./node_modules/terser/bin/terser
|
||||||
|
UGLIFYCSS=./node_modules/uglifycss/uglifycss
|
||||||
|
|
||||||
VERSION=1.2.1
|
VERSION=1.2.1
|
||||||
|
|
||||||
@ -68,7 +71,7 @@ lite: build_javascripts build_themes build_packages
|
|||||||
|
|
||||||
ts:
|
ts:
|
||||||
-rm -rf dist
|
-rm -rf dist
|
||||||
tsc -p tsconfig.json
|
$(TSC) -p tsconfig.json
|
||||||
cat `find dist/core/ -name "*.d.ts"` > d.ts/antos.d.ts
|
cat `find dist/core/ -name "*.d.ts"` > d.ts/antos.d.ts
|
||||||
rm `find dist/ -name "*.d.ts"`
|
rm `find dist/ -name "*.d.ts"`
|
||||||
cat d.ts/core.d.ts d.ts/jquery.d.ts d.ts/antos.d.ts > /tmp/corelib.d.ts
|
cat d.ts/core.d.ts d.ts/jquery.d.ts d.ts/antos.d.ts > /tmp/corelib.d.ts
|
||||||
@ -85,7 +88,7 @@ standalone_tags: ts
|
|||||||
rm "$${f}";\
|
rm "$${f}";\
|
||||||
done
|
done
|
||||||
echo "var Ant=this;" >> dist/afx.js
|
echo "var Ant=this;" >> dist/afx.js
|
||||||
terser dist/afx.js --compress --mangle --output $(BUILDDIR)/afx.js
|
$(UGLIFYJS) dist/afx.js --compress --mangle --output $(BUILDDIR)/afx.js
|
||||||
# standalone theme
|
# standalone theme
|
||||||
|
|
||||||
@for f in src/themes/system/afx-*.css; do \
|
@for f in src/themes/system/afx-*.css; do \
|
||||||
@ -101,7 +104,7 @@ standalone_tags: ts
|
|||||||
(cat "$${f}"; echo) >> $(BUILDDIR)/afx.css; \
|
(cat "$${f}"; echo) >> $(BUILDDIR)/afx.css; \
|
||||||
fi;\
|
fi;\
|
||||||
done
|
done
|
||||||
# uglifycss --output $(BUILDDIR)/afx.css $(BUILDDIR)/afx.css
|
# $(UGLIFYCSS) --output $(BUILDDIR)/afx.css $(BUILDDIR)/afx.css
|
||||||
rm -r dist/core
|
rm -r dist/core
|
||||||
|
|
||||||
build_javascripts: ts
|
build_javascripts: ts
|
||||||
@ -173,27 +176,27 @@ package:
|
|||||||
pkgar:
|
pkgar:
|
||||||
read -r -p "Enter package name: " PKG;\
|
read -r -p "Enter package name: " PKG;\
|
||||||
echo $$PKG | make package &&\
|
echo $$PKG | make package &&\
|
||||||
test -f $(BUILDDIR)/packages/$$PKG/main.js && terser $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
|
test -f $(BUILDDIR)/packages/$$PKG/main.js && $(UGLIFYJS) $(BUILDDIR)/packages/$$PKG/main.js --compress --mangle --output $(BUILDDIR)/packages/$$PKG/main.js;\
|
||||||
test -f $(BUILDDIR)/packages/$$PKG/main.css && uglifycss --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\
|
test -f $(BUILDDIR)/packages/$$PKG/main.css && $(UGLIFYCSS) --output $(BUILDDIR)/packages/$$PKG/main.css $(BUILDDIR)/packages/$$PKG/main.css;\
|
||||||
cd $(BUILDDIR)/packages/$$PKG && zip -r "$$PKG.zip" ./ ; \
|
cd $(BUILDDIR)/packages/$$PKG && zip -r "$$PKG.zip" ./ ; \
|
||||||
cd ../../ && (test -d repo/$$PKG || mkdir repo/$$PKG) && mv packages/$$PKG/"$$PKG.zip" repo/$$PKG && touch repo/$$PKG/$$PKG.md && rm -r packages/$$PKG
|
cd ../../ && (test -d repo/$$PKG || mkdir repo/$$PKG) && mv packages/$$PKG/"$$PKG.zip" repo/$$PKG && touch repo/$$PKG/$$PKG.md && rm -r packages/$$PKG
|
||||||
|
|
||||||
uglify:
|
uglify:
|
||||||
# sudo npm install terser -g
|
# sudo npm install $(UGLIFYJS) -g
|
||||||
#
|
#
|
||||||
terser $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
|
$(UGLIFYJS) $(BUILDDIR)/scripts/antos.js --compress --mangle --output $(BUILDDIR)/scripts/antos.js
|
||||||
# uglify tags
|
# uglify tags
|
||||||
# npm install uglifycss -g
|
# npm install $(UGLIFYCSS) -g
|
||||||
# uglify the css
|
# uglify the css
|
||||||
uglifycss --output $(BUILDDIR)/resources/themes/antos_light/antos_light.css $(BUILDDIR)/resources/themes/antos_light/antos_light.css
|
$(UGLIFYCSS) --output $(BUILDDIR)/resources/themes/antos_light/antos_light.css $(BUILDDIR)/resources/themes/antos_light/antos_light.css
|
||||||
uglifycss --output $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css
|
$(UGLIFYCSS) --output $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css $(BUILDDIR)/resources/themes/antos_dark/antos_dark.css
|
||||||
uglifycss --output $(BUILDDIR)/resources/themes/system/system.css $(BUILDDIR)/resources/themes/system/system.css
|
$(UGLIFYCSS) --output $(BUILDDIR)/resources/themes/system/system.css $(BUILDDIR)/resources/themes/system/system.css
|
||||||
#uglify each packages
|
#uglify each packages
|
||||||
|
|
||||||
for d in $(packages); do\
|
for d in $(packages); do\
|
||||||
echo "Uglifying $$d";\
|
echo "Uglifying $$d";\
|
||||||
test -f $(BUILDDIR)/packages/$$d/main.js && terser $(BUILDDIR)/packages/$$d/main.js --compress --mangle --output $(BUILDDIR)/packages/$$d/main.js;\
|
test -f $(BUILDDIR)/packages/$$d/main.js && $(UGLIFYJS) $(BUILDDIR)/packages/$$d/main.js --compress --mangle --output $(BUILDDIR)/packages/$$d/main.js;\
|
||||||
test -f $(BUILDDIR)/packages/$$d/main.css && uglifycss --output $(BUILDDIR)/packages/$$d/main.css $(BUILDDIR)/packages/$$d/main.css;\
|
test -f $(BUILDDIR)/packages/$$d/main.css && $(UGLIFYCSS) --output $(BUILDDIR)/packages/$$d/main.css $(BUILDDIR)/packages/$$d/main.css;\
|
||||||
done
|
done
|
||||||
|
|
||||||
ar:
|
ar:
|
||||||
|
10766
d.ts/antos.d.ts
vendored
10766
d.ts/antos.d.ts
vendored
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -992,15 +992,9 @@ namespace OS {
|
|||||||
// desktop[0].set "selected", -1
|
// desktop[0].set "selected", -1
|
||||||
|
|
||||||
$(desktop).on("click", function (e) {
|
$(desktop).on("click", function (e) {
|
||||||
let el = $(e.target).parent();
|
let el = $(e.target).closest("afx-app-window")[0];
|
||||||
if (!(el.length > 0)) {
|
if(el)
|
||||||
return;
|
{
|
||||||
}
|
|
||||||
el = el.parent();
|
|
||||||
if (!(el.length > 0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (el[0] !== desktop) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
desktop.unselect();
|
desktop.unselect();
|
||||||
|
@ -108,7 +108,7 @@ namespace OS {
|
|||||||
* @protected
|
* @protected
|
||||||
* @memberof WindowTag
|
* @memberof WindowTag
|
||||||
*/
|
*/
|
||||||
protected calibrate(): void {}
|
protected calibrate(): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do nothing
|
* Do nothing
|
||||||
@ -117,7 +117,7 @@ namespace OS {
|
|||||||
* @param {*} [d]
|
* @param {*} [d]
|
||||||
* @memberof WindowTag
|
* @memberof WindowTag
|
||||||
*/
|
*/
|
||||||
protected reload(d?: any): void {}
|
protected reload(d?: any): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter: Set the window width
|
* Setter: Set the window width
|
||||||
@ -245,18 +245,18 @@ namespace OS {
|
|||||||
* @memberof WindowTag
|
* @memberof WindowTag
|
||||||
*/
|
*/
|
||||||
protected mount(): void {
|
protected mount(): void {
|
||||||
this.contextmenuHandle = function (e) {};
|
this.contextmenuHandle = function (e) { };
|
||||||
$(this.refs["minbt"]).on("click",(e) => {
|
$(this.refs["minbt"]).on("click", (e) => {
|
||||||
return this.observable.trigger("hide", {
|
return this.observable.trigger("hide", {
|
||||||
id: this.aid,
|
id: this.aid,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(this.refs["maxbt"]).on("click",(e) => {
|
$(this.refs["maxbt"]).on("click", (e) => {
|
||||||
return this.toggle_window();
|
return this.toggle_window();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(this.refs["closebt"]).on("click",(e) => {
|
$(this.refs["closebt"]).on("click", (e) => {
|
||||||
return this.observable.trigger("exit", {
|
return this.observable.trigger("exit", {
|
||||||
id: this.aid,
|
id: this.aid,
|
||||||
});
|
});
|
||||||
@ -276,8 +276,8 @@ namespace OS {
|
|||||||
id: this.aid,
|
id: this.aid,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
//$(this.refs.win_overlay).css("background-color", "red");
|
||||||
$(this.refs["dragger"]).on("dblclick",(e) => {
|
$(this.refs["dragger"]).on("dblclick", (e) => {
|
||||||
return this.toggle_window();
|
return this.toggle_window();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -290,11 +290,13 @@ namespace OS {
|
|||||||
.css("z-index", Ant.OS.GUI.zindex)
|
.css("z-index", Ant.OS.GUI.zindex)
|
||||||
.removeClass("unactive");
|
.removeClass("unactive");
|
||||||
this._shown = true;
|
this._shown = true;
|
||||||
|
$(this.refs.win_overlay).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.observable.on("blur", () => {
|
this.observable.on("blur", () => {
|
||||||
this._shown = false;
|
this._shown = false;
|
||||||
return $(this).addClass("unactive");
|
$(this).addClass("unactive");
|
||||||
|
$(this.refs.win_overlay).show();
|
||||||
});
|
});
|
||||||
this.observable.on("hide", () => {
|
this.observable.on("hide", () => {
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
@ -408,12 +410,10 @@ namespace OS {
|
|||||||
let w = $(this).width();
|
let w = $(this).width();
|
||||||
let h = $(this).height();
|
let h = $(this).height();
|
||||||
$(this.refs.win_overlay).show();
|
$(this.refs.win_overlay).show();
|
||||||
if(target != this.refs.grip_bottom)
|
if (target != this.refs.grip_bottom) {
|
||||||
{
|
|
||||||
w += e.clientX - offset.left;
|
w += e.clientX - offset.left;
|
||||||
}
|
}
|
||||||
if(target != this.refs.grip_right)
|
if (target != this.refs.grip_right) {
|
||||||
{
|
|
||||||
h += e.clientY - offset.top;
|
h += e.clientY - offset.top;
|
||||||
}
|
}
|
||||||
w = w < 100 ? 100 : w;
|
w = w < 100 ? 100 : w;
|
||||||
|
Loading…
Reference in New Issue
Block a user