modern-canvas 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +198 -260
- package/dist/index.d.cts +64 -80
- package/dist/index.d.mts +64 -80
- package/dist/index.d.ts +64 -80
- package/dist/index.js +97 -49
- package/dist/index.mjs +193 -254
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineProperty, getDeclarations, parseColor, property, RawWeakMap as RawWeakMap$1, isGradient, clearUndef, idGenerator, normalizeFill, isNone, normalizeBackground, normalizeForeground, normalizeOutline, normalizeShadow, normalizeShape, getDefaultStyle, normalizeText } from 'modern-idoc';
|
|
1
|
+
import { defineProperty, EventEmitter, getDeclarations, parseColor, property, RawWeakMap as RawWeakMap$1, isGradient, clearUndef, idGenerator, normalizeFill, isNone, normalizeBackground, normalizeForeground, normalizeOutline, normalizeShadow, normalizeShape, getDefaultStyle, normalizeText } from 'modern-idoc';
|
|
2
2
|
import { extend } from 'colord';
|
|
3
3
|
import namesPlugin from 'colord/plugins/names';
|
|
4
4
|
import { Path2D, Path2DSet, svgToDom, svgToPath2DSet, Matrix3 as Matrix3$1 } from 'modern-path2d';
|
|
@@ -125,245 +125,6 @@ async function nextTick(cb) {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
class EventEmitter {
|
|
129
|
-
eventListeners = /* @__PURE__ */ new Map();
|
|
130
|
-
removeAllListeners() {
|
|
131
|
-
this.eventListeners.clear();
|
|
132
|
-
return this;
|
|
133
|
-
}
|
|
134
|
-
hasEventListener(event) {
|
|
135
|
-
return this.eventListeners.has(event);
|
|
136
|
-
}
|
|
137
|
-
on(type, listener, options) {
|
|
138
|
-
const object = { value: listener, options };
|
|
139
|
-
const listeners = this.eventListeners.get(type);
|
|
140
|
-
if (!listeners) {
|
|
141
|
-
this.eventListeners.set(type, object);
|
|
142
|
-
} else if (Array.isArray(listeners)) {
|
|
143
|
-
listeners.push(object);
|
|
144
|
-
} else {
|
|
145
|
-
this.eventListeners.set(type, [listeners, object]);
|
|
146
|
-
}
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
once(type, listener) {
|
|
150
|
-
return this.on(type, listener, { once: true });
|
|
151
|
-
}
|
|
152
|
-
off(type, listener, options) {
|
|
153
|
-
if (!listener) {
|
|
154
|
-
this.eventListeners.delete(type);
|
|
155
|
-
return this;
|
|
156
|
-
}
|
|
157
|
-
const listeners = this.eventListeners.get(type);
|
|
158
|
-
if (!listeners) {
|
|
159
|
-
return this;
|
|
160
|
-
}
|
|
161
|
-
if (Array.isArray(listeners)) {
|
|
162
|
-
const events = [];
|
|
163
|
-
for (let i = 0, length = listeners.length; i < length; i++) {
|
|
164
|
-
const object = listeners[i];
|
|
165
|
-
if (object.value !== listener || typeof options === "object" && options?.once && (typeof object.options === "boolean" || !object.options?.once)) {
|
|
166
|
-
events.push(object);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if (events.length) {
|
|
170
|
-
this.eventListeners.set(type, events.length === 1 ? events[0] : events);
|
|
171
|
-
} else {
|
|
172
|
-
this.eventListeners.delete(type);
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
if (listeners.value === listener && (typeof options === "boolean" || !options?.once || (typeof listeners.options === "boolean" || listeners.options?.once))) {
|
|
176
|
-
this.eventListeners.delete(type);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return this;
|
|
180
|
-
}
|
|
181
|
-
emit(type, ...args) {
|
|
182
|
-
const listeners = this.eventListeners.get(type);
|
|
183
|
-
if (listeners) {
|
|
184
|
-
if (Array.isArray(listeners)) {
|
|
185
|
-
for (let len = listeners.length, i = 0; i < len; i++) {
|
|
186
|
-
const object = listeners[i];
|
|
187
|
-
if (typeof object.options === "object" && object.options?.once) {
|
|
188
|
-
this.off(type, object.value, object.options);
|
|
189
|
-
}
|
|
190
|
-
object.value.apply(this, args);
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
193
|
-
if (typeof listeners.options === "object" && listeners.options?.once) {
|
|
194
|
-
this.off(type, listeners.value, listeners.options);
|
|
195
|
-
}
|
|
196
|
-
listeners.value.apply(this, args);
|
|
197
|
-
}
|
|
198
|
-
return true;
|
|
199
|
-
} else {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
let IID = 0;
|
|
206
|
-
class CoreObject extends EventEmitter {
|
|
207
|
-
instanceId = ++IID;
|
|
208
|
-
_customPropertyAccessor;
|
|
209
|
-
_properties = /* @__PURE__ */ new Map();
|
|
210
|
-
_updatedProperties = /* @__PURE__ */ new Map();
|
|
211
|
-
_changedProperties = /* @__PURE__ */ new Set();
|
|
212
|
-
_updatingPromise = Promise.resolve();
|
|
213
|
-
_updating = false;
|
|
214
|
-
useCustomPropertyAccessor(accessor) {
|
|
215
|
-
this._customPropertyAccessor = accessor;
|
|
216
|
-
this.getPropertyDeclarations().forEach((declaration, key) => {
|
|
217
|
-
const newValue = accessor.get(key, () => void 0);
|
|
218
|
-
const oldValue = this._properties.get(key);
|
|
219
|
-
if (newValue === void 0) {
|
|
220
|
-
if (oldValue !== void 0) {
|
|
221
|
-
accessor.set(key, oldValue);
|
|
222
|
-
}
|
|
223
|
-
} else if (newValue !== oldValue) {
|
|
224
|
-
this._properties.set(key, newValue);
|
|
225
|
-
this._updateProperty(key, newValue, oldValue, declaration);
|
|
226
|
-
this.emit("updateProperty", key, newValue, oldValue, declaration);
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
return this;
|
|
230
|
-
}
|
|
231
|
-
getter(key, context) {
|
|
232
|
-
if (context.declaration.protected) {
|
|
233
|
-
return this[context.internalKey];
|
|
234
|
-
} else {
|
|
235
|
-
return this._customPropertyAccessor ? this._customPropertyAccessor.get(key, () => this._properties.get(key)) : this._properties.get(key);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
setter(key, value, context) {
|
|
239
|
-
if (context.declaration.protected) {
|
|
240
|
-
this[context.internalKey] = value;
|
|
241
|
-
} else {
|
|
242
|
-
if (this._customPropertyAccessor) {
|
|
243
|
-
this._customPropertyAccessor.set(key, value);
|
|
244
|
-
}
|
|
245
|
-
this._properties.set(key, value);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
equal(target) {
|
|
249
|
-
return Boolean(target && this.instanceId === target.instanceId);
|
|
250
|
-
}
|
|
251
|
-
async _enqueueUpdate() {
|
|
252
|
-
this._updating = true;
|
|
253
|
-
try {
|
|
254
|
-
await this._updatingPromise;
|
|
255
|
-
} catch (e) {
|
|
256
|
-
Promise.reject(e);
|
|
257
|
-
}
|
|
258
|
-
await nextTick();
|
|
259
|
-
if (!this._updating)
|
|
260
|
-
return;
|
|
261
|
-
this.update();
|
|
262
|
-
this._updating = false;
|
|
263
|
-
}
|
|
264
|
-
update() {
|
|
265
|
-
this._update(this._updatedProperties);
|
|
266
|
-
this._updatedProperties = /* @__PURE__ */ new Map();
|
|
267
|
-
}
|
|
268
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
269
|
-
_update(changed) {
|
|
270
|
-
}
|
|
271
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
272
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
273
|
-
}
|
|
274
|
-
isDirty(key) {
|
|
275
|
-
return this._updatedProperties.has(key);
|
|
276
|
-
}
|
|
277
|
-
getPropertyDeclarations() {
|
|
278
|
-
return getDeclarations(this.constructor);
|
|
279
|
-
}
|
|
280
|
-
getPropertyDeclaration(key) {
|
|
281
|
-
return this.getPropertyDeclarations().get(key);
|
|
282
|
-
}
|
|
283
|
-
getProperty(key) {
|
|
284
|
-
return this[key];
|
|
285
|
-
}
|
|
286
|
-
setProperty(key, value) {
|
|
287
|
-
this[key] = value;
|
|
288
|
-
return this;
|
|
289
|
-
}
|
|
290
|
-
getProperties(keys) {
|
|
291
|
-
const properties = {};
|
|
292
|
-
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
293
|
-
if (!property.protected && !property.alias && (!keys || keys.includes(name))) {
|
|
294
|
-
properties[name] = this.getProperty(name);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return properties;
|
|
298
|
-
}
|
|
299
|
-
setProperties(properties) {
|
|
300
|
-
if (properties && typeof properties === "object") {
|
|
301
|
-
for (const [name] of this.getPropertyDeclarations()) {
|
|
302
|
-
if (name in properties) {
|
|
303
|
-
this.setProperty(name, properties[name]);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return this;
|
|
308
|
-
}
|
|
309
|
-
resetProperties() {
|
|
310
|
-
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
311
|
-
this.setProperty(
|
|
312
|
-
name,
|
|
313
|
-
typeof property.fallback === "function" ? property.fallback() : property.fallback
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
return this;
|
|
317
|
-
}
|
|
318
|
-
onUpdateProperty(key, newValue, oldValue, declaration) {
|
|
319
|
-
this.requestUpdate(key, newValue, oldValue, declaration);
|
|
320
|
-
}
|
|
321
|
-
requestUpdate(key, newValue, oldValue, declaration) {
|
|
322
|
-
if (key !== void 0) {
|
|
323
|
-
if (!Object.is(newValue, oldValue)) {
|
|
324
|
-
this._updatedProperties.set(key, oldValue);
|
|
325
|
-
this._changedProperties.add(key);
|
|
326
|
-
declaration ??= this.getPropertyDeclaration(key);
|
|
327
|
-
this._updateProperty(key, newValue, oldValue, declaration);
|
|
328
|
-
this.emit("updateProperty", key, newValue, oldValue, declaration);
|
|
329
|
-
} else {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
if (!this._updating) {
|
|
334
|
-
this._updatingPromise = this._enqueueUpdate();
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
toJSON() {
|
|
338
|
-
const json = {};
|
|
339
|
-
this._properties.forEach((value, key) => {
|
|
340
|
-
if (value === void 0) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
if (value && typeof value === "object") {
|
|
344
|
-
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
345
|
-
json[key] = value.toJSON();
|
|
346
|
-
} else {
|
|
347
|
-
json[key] = { ...value };
|
|
348
|
-
}
|
|
349
|
-
} else {
|
|
350
|
-
json[key] = value;
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
return json;
|
|
354
|
-
}
|
|
355
|
-
clone() {
|
|
356
|
-
return new this.constructor(this.toJSON());
|
|
357
|
-
}
|
|
358
|
-
free() {
|
|
359
|
-
this.removeAllListeners();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
class RefCounted extends CoreObject {
|
|
364
|
-
//
|
|
365
|
-
}
|
|
366
|
-
|
|
367
128
|
const PI = Math.PI;
|
|
368
129
|
const PI_2 = PI * 2;
|
|
369
130
|
let UID = 0;
|
|
@@ -1049,6 +810,172 @@ class Input extends EventEmitter {
|
|
|
1049
810
|
};
|
|
1050
811
|
}
|
|
1051
812
|
|
|
813
|
+
let IID = 0;
|
|
814
|
+
class CoreObject extends EventEmitter {
|
|
815
|
+
instanceId = ++IID;
|
|
816
|
+
_customPropertyAccessor;
|
|
817
|
+
_properties = /* @__PURE__ */ new Map();
|
|
818
|
+
_updatedProperties = /* @__PURE__ */ new Map();
|
|
819
|
+
_changedProperties = /* @__PURE__ */ new Set();
|
|
820
|
+
_updatingPromise = Promise.resolve();
|
|
821
|
+
_updating = false;
|
|
822
|
+
useCustomPropertyAccessor(accessor) {
|
|
823
|
+
this._customPropertyAccessor = accessor;
|
|
824
|
+
this.getPropertyDeclarations().forEach((declaration, key) => {
|
|
825
|
+
const newValue = accessor.get(key, () => void 0);
|
|
826
|
+
const oldValue = this._properties.get(key);
|
|
827
|
+
if (newValue === void 0) {
|
|
828
|
+
if (oldValue !== void 0) {
|
|
829
|
+
accessor.set(key, oldValue);
|
|
830
|
+
}
|
|
831
|
+
} else if (newValue !== oldValue) {
|
|
832
|
+
if (declaration.alias && declaration.alias !== key) {
|
|
833
|
+
this.setProperty(key, newValue);
|
|
834
|
+
} else {
|
|
835
|
+
this._properties.set(key, newValue);
|
|
836
|
+
}
|
|
837
|
+
this._updateProperty(key, newValue, oldValue, declaration);
|
|
838
|
+
this.emit("updateProperty", key, newValue, oldValue, declaration);
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
return this;
|
|
842
|
+
}
|
|
843
|
+
getter(key, context) {
|
|
844
|
+
if (context?.declaration.protected) {
|
|
845
|
+
return this[context.internalKey];
|
|
846
|
+
} else {
|
|
847
|
+
return this._customPropertyAccessor ? this._customPropertyAccessor.get(key, () => this._properties.get(key)) : this._properties.get(key);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
setter(key, value, context) {
|
|
851
|
+
if (context?.declaration.protected) {
|
|
852
|
+
this[context.internalKey] = value;
|
|
853
|
+
} else {
|
|
854
|
+
if (this._customPropertyAccessor) {
|
|
855
|
+
this._customPropertyAccessor.set(key, value);
|
|
856
|
+
}
|
|
857
|
+
this._properties.set(key, value);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
equal(target) {
|
|
861
|
+
return Boolean(target && this.instanceId === target.instanceId);
|
|
862
|
+
}
|
|
863
|
+
async _enqueueUpdate() {
|
|
864
|
+
this._updating = true;
|
|
865
|
+
try {
|
|
866
|
+
await this._updatingPromise;
|
|
867
|
+
} catch (e) {
|
|
868
|
+
Promise.reject(e);
|
|
869
|
+
}
|
|
870
|
+
await nextTick();
|
|
871
|
+
if (!this._updating)
|
|
872
|
+
return;
|
|
873
|
+
this.update();
|
|
874
|
+
this._updating = false;
|
|
875
|
+
}
|
|
876
|
+
update() {
|
|
877
|
+
this._update(this._updatedProperties);
|
|
878
|
+
this._updatedProperties = /* @__PURE__ */ new Map();
|
|
879
|
+
}
|
|
880
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
881
|
+
_update(changed) {
|
|
882
|
+
}
|
|
883
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
884
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
885
|
+
}
|
|
886
|
+
isDirty(key) {
|
|
887
|
+
return this._updatedProperties.has(key);
|
|
888
|
+
}
|
|
889
|
+
getPropertyDeclarations() {
|
|
890
|
+
return getDeclarations(this.constructor);
|
|
891
|
+
}
|
|
892
|
+
getPropertyDeclaration(key) {
|
|
893
|
+
return this.getPropertyDeclarations().get(key);
|
|
894
|
+
}
|
|
895
|
+
getProperty(key) {
|
|
896
|
+
return this[key];
|
|
897
|
+
}
|
|
898
|
+
setProperty(key, value) {
|
|
899
|
+
this[key] = value;
|
|
900
|
+
return this;
|
|
901
|
+
}
|
|
902
|
+
getProperties(keys) {
|
|
903
|
+
const properties = {};
|
|
904
|
+
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
905
|
+
if (!property.protected && !property.alias && (!keys || keys.includes(name))) {
|
|
906
|
+
properties[name] = this.getProperty(name);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
return properties;
|
|
910
|
+
}
|
|
911
|
+
setProperties(properties) {
|
|
912
|
+
if (properties && typeof properties === "object") {
|
|
913
|
+
for (const [name] of this.getPropertyDeclarations()) {
|
|
914
|
+
if (name in properties) {
|
|
915
|
+
this.setProperty(name, properties[name]);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return this;
|
|
920
|
+
}
|
|
921
|
+
resetProperties() {
|
|
922
|
+
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
923
|
+
this.setProperty(
|
|
924
|
+
name,
|
|
925
|
+
typeof property.fallback === "function" ? property.fallback() : property.fallback
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
return this;
|
|
929
|
+
}
|
|
930
|
+
onUpdateProperty(key, newValue, oldValue, declaration) {
|
|
931
|
+
this.requestUpdate(key, newValue, oldValue, declaration);
|
|
932
|
+
}
|
|
933
|
+
requestUpdate(key, newValue, oldValue, declaration) {
|
|
934
|
+
if (key !== void 0) {
|
|
935
|
+
if (!Object.is(newValue, oldValue)) {
|
|
936
|
+
this._updatedProperties.set(key, oldValue);
|
|
937
|
+
this._changedProperties.add(key);
|
|
938
|
+
declaration ??= this.getPropertyDeclaration(key);
|
|
939
|
+
this._updateProperty(key, newValue, oldValue, declaration);
|
|
940
|
+
this.emit("updateProperty", key, newValue, oldValue, declaration);
|
|
941
|
+
} else {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
if (!this._updating) {
|
|
946
|
+
this._updatingPromise = this._enqueueUpdate();
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
toJSON() {
|
|
950
|
+
const json = {};
|
|
951
|
+
this._properties.forEach((value, key) => {
|
|
952
|
+
if (value === void 0) {
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
if (value && typeof value === "object") {
|
|
956
|
+
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
957
|
+
json[key] = value.toJSON();
|
|
958
|
+
} else {
|
|
959
|
+
json[key] = { ...value };
|
|
960
|
+
}
|
|
961
|
+
} else {
|
|
962
|
+
json[key] = value;
|
|
963
|
+
}
|
|
964
|
+
});
|
|
965
|
+
return json;
|
|
966
|
+
}
|
|
967
|
+
clone() {
|
|
968
|
+
return new this.constructor(this.toJSON());
|
|
969
|
+
}
|
|
970
|
+
free() {
|
|
971
|
+
this.removeAllListeners();
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
class RefCounted extends CoreObject {
|
|
976
|
+
//
|
|
977
|
+
}
|
|
978
|
+
|
|
1052
979
|
class Resource extends RefCounted {
|
|
1053
980
|
//
|
|
1054
981
|
}
|
|
@@ -9336,6 +9263,15 @@ class BaseElement2DText extends CoreObject {
|
|
|
9336
9263
|
constructor(parent) {
|
|
9337
9264
|
super();
|
|
9338
9265
|
this.parent = parent;
|
|
9266
|
+
this.base.on("updateProperty", (...args) => {
|
|
9267
|
+
switch (args[0]) {
|
|
9268
|
+
case "content":
|
|
9269
|
+
case "effects":
|
|
9270
|
+
this.setter(args[0], args[1]);
|
|
9271
|
+
break;
|
|
9272
|
+
}
|
|
9273
|
+
this._updateProperty(...args);
|
|
9274
|
+
});
|
|
9339
9275
|
}
|
|
9340
9276
|
base = new Text();
|
|
9341
9277
|
measureResult;
|
|
@@ -9539,7 +9475,10 @@ var __decorateClass$l = (decorators, target, key, kind) => {
|
|
|
9539
9475
|
return result;
|
|
9540
9476
|
};
|
|
9541
9477
|
let BaseElement2D = class extends Node2D {
|
|
9542
|
-
size = new Vector2().on("update", () =>
|
|
9478
|
+
size = new Vector2().on("update", () => {
|
|
9479
|
+
this.updateGlobalTransform();
|
|
9480
|
+
this.requestRedraw();
|
|
9481
|
+
});
|
|
9543
9482
|
get style() {
|
|
9544
9483
|
return this._style;
|
|
9545
9484
|
}
|
|
@@ -9633,15 +9572,6 @@ let BaseElement2D = class extends Node2D {
|
|
|
9633
9572
|
return this;
|
|
9634
9573
|
}
|
|
9635
9574
|
_updateStyleProperty(key, value, _oldValue, _declaration) {
|
|
9636
|
-
switch (key) {
|
|
9637
|
-
case "width":
|
|
9638
|
-
case "height":
|
|
9639
|
-
if (this.mask instanceof BaseElement2D) {
|
|
9640
|
-
this.mask.size.x = this.size.x;
|
|
9641
|
-
this.mask.size.y = this.size.y;
|
|
9642
|
-
}
|
|
9643
|
-
break;
|
|
9644
|
-
}
|
|
9645
9575
|
switch (key) {
|
|
9646
9576
|
case "rotate":
|
|
9647
9577
|
this.rotation = this.style.rotate * DEG_TO_RAD;
|
|
@@ -9934,6 +9864,15 @@ let Element2D = class extends BaseElement2D {
|
|
|
9934
9864
|
this.size.height = Number(value);
|
|
9935
9865
|
break;
|
|
9936
9866
|
}
|
|
9867
|
+
switch (key) {
|
|
9868
|
+
case "width":
|
|
9869
|
+
case "height":
|
|
9870
|
+
if (this.mask instanceof BaseElement2D) {
|
|
9871
|
+
this.mask.size.width = this.size.width;
|
|
9872
|
+
this.mask.size.height = this.size.height;
|
|
9873
|
+
}
|
|
9874
|
+
break;
|
|
9875
|
+
}
|
|
9937
9876
|
}
|
|
9938
9877
|
};
|
|
9939
9878
|
Element2D = __decorateClass$k([
|
|
@@ -12834,13 +12773,13 @@ let Scaler = class extends Node {
|
|
|
12834
12773
|
}
|
|
12835
12774
|
};
|
|
12836
12775
|
__decorateClass$4([
|
|
12837
|
-
property()
|
|
12776
|
+
property({ default: 1 })
|
|
12838
12777
|
], Scaler.prototype, "value", 2);
|
|
12839
12778
|
__decorateClass$4([
|
|
12840
|
-
property()
|
|
12779
|
+
property({ default: 0.05 })
|
|
12841
12780
|
], Scaler.prototype, "minValue", 2);
|
|
12842
12781
|
__decorateClass$4([
|
|
12843
|
-
property()
|
|
12782
|
+
property({ default: 10 })
|
|
12844
12783
|
], Scaler.prototype, "maxValue", 2);
|
|
12845
12784
|
Scaler = __decorateClass$4([
|
|
12846
12785
|
customNode("Scaler", {
|
|
@@ -13980,4 +13919,4 @@ async function render(options) {
|
|
|
13980
13919
|
});
|
|
13981
13920
|
}
|
|
13982
13921
|
|
|
13983
|
-
export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, CanvasContext, CanvasItem, CanvasItemEditor, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine,
|
|
13922
|
+
export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, CanvasContext, CanvasItem, CanvasItemEditor, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine, FlexElement2D, FlexElement2DStyle, FlexLayout, FontLoader, GIFLoader, GaussianBlurEffect, Geometry, GlitchEffect, GodrayEffect, GradientTexture, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, ImageTexture, IndexBuffer, Input, InputEvent, JSONLoader, KawaseBlurEffect, KawaseTransition, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, OutlineEffect, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, Scaler, SceneTree, ScrollBar, Text2D, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, TransformRect2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, XScrollBar, YScrollBar, ZoomBlurEffect, assets, clamp, clampFrag, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, frag$1 as frag, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, render, timingFunctions, uid };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-canvas",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.5",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "A JavaScript WebGL rendering engine.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"colord": "^2.9.3",
|
|
71
71
|
"earcut": "^3.0.1",
|
|
72
72
|
"modern-font": "^0.4.1",
|
|
73
|
-
"modern-idoc": "^0.
|
|
73
|
+
"modern-idoc": "^0.8.1",
|
|
74
74
|
"modern-path2d": "^1.4.1",
|
|
75
|
-
"modern-text": "^1.
|
|
75
|
+
"modern-text": "^1.6.0",
|
|
76
76
|
"yoga-layout": "^3.2.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"simple-git-hooks": "^2.13.0",
|
|
89
89
|
"typescript": "^5.8.3",
|
|
90
90
|
"unbuild": "^3.5.0",
|
|
91
|
-
"vite": "^7.0.
|
|
91
|
+
"vite": "^7.0.2",
|
|
92
92
|
"vitest": "^3.2.4"
|
|
93
93
|
},
|
|
94
94
|
"simple-git-hooks": {
|