两个版本的插件

This commit is contained in:
onvia
2023-07-20 19:00:23 +08:00
parent 44bce05250
commit 68895155e5
2385 changed files with 1826008 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Color = void 0;
class Color {
constructor(r, g, b, a) {
this.r = Math.ceil(r || 0);
this.g = Math.ceil(g || 0);
this.b = Math.ceil(b || 0);
this.a = Math.ceil(a || 0);
}
set(color) {
this.r = Math.ceil(color.r || 0);
this.g = Math.ceil(color.g || 0);
this.b = Math.ceil(color.b || 0);
this.a = Math.ceil(color.a || 0);
}
toHEX(fmt = '#rrggbb') {
const prefix = '0';
// #rrggbb
const hex = [
(this.r < 16 ? prefix : '') + (this.r).toString(16),
(this.g < 16 ? prefix : '') + (this.g).toString(16),
(this.b < 16 ? prefix : '') + (this.b).toString(16),
];
const i = -1;
if (fmt === '#rgb') {
hex[0] = hex[0][0];
hex[1] = hex[1][0];
hex[2] = hex[2][0];
}
else if (fmt === '#rrggbbaa') {
hex.push((this.a < 16 ? prefix : '') + (this.a).toString(16));
}
return hex.join('');
}
}
exports.Color = Color;

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rect = void 0;
class Rect {
constructor(left = 0, right = 0, top = 0, bottom = 0) {
if (typeof left == 'object') {
this.set(left);
return;
}
this.left = left || 0;
this.right = right || 0;
this.top = top || 0;
this.bottom = bottom || 0;
}
set(rect) {
this.left = rect.left;
this.right = rect.right;
this.top = rect.top;
this.bottom = rect.bottom;
}
}
exports.Rect = Rect;

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Size = void 0;
class Size {
constructor(width = 0, height = 0) {
this.width = width || 0;
this.height = height || 0;
}
}
exports.Size = Size;

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Vec2 = void 0;
class Vec2 {
constructor(x = 0, y = 0) {
this.x = x || 0;
this.y = y || 0;
}
}
exports.Vec2 = Vec2;

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Vec3 = void 0;
class Vec3 {
constructor(x = 0, y = 0, z = 0) {
this.x = x || 0;
this.y = y || 0;
this.z = z || 0;
}
}
exports.Vec3 = Vec3;