@meta2d/core 1.1.15 → 1.1.18
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/package.json +1 -1
- package/src/canvas/canvas.js +22 -6
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +2 -0
- package/src/core.js +51 -2
- package/src/core.js.map +1 -1
- package/src/diagrams/gif.js +1 -1
- package/src/diagrams/gif.js.map +1 -1
- package/src/diagrams/iframe.js +2 -2
- package/src/diagrams/iframe.js.map +1 -1
- package/src/diagrams/line/dirMarkers.d.ts +5 -0
- package/src/diagrams/line/dirMarkers.js +133 -0
- package/src/diagrams/line/dirMarkers.js.map +1 -0
- package/src/diagrams/line/index.d.ts +1 -0
- package/src/diagrams/line/index.js +1 -0
- package/src/diagrams/line/index.js.map +1 -1
- package/src/diagrams/line/line.js +7 -2
- package/src/diagrams/line/line.js.map +1 -1
- package/src/diagrams/video.js +3 -1
- package/src/diagrams/video.js.map +1 -1
- package/src/options.d.ts +7 -0
- package/src/options.js +3 -0
- package/src/options.js.map +1 -1
- package/src/pen/index.d.ts +2 -0
- package/src/pen/index.js +1 -0
- package/src/pen/index.js.map +1 -1
- package/src/pen/model.d.ts +3 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +22 -2
- package/src/pen/render.js.map +1 -1
- package/src/title/title.js +19 -3
- package/src/title/title.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -855,7 +855,12 @@ export class Canvas {
|
|
|
855
855
|
case 'z':
|
|
856
856
|
case 'Z':
|
|
857
857
|
if (e.ctrlKey || e.metaKey) {
|
|
858
|
-
|
|
858
|
+
if (e.shiftKey) {
|
|
859
|
+
this.redo();
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
this.undo();
|
|
863
|
+
}
|
|
859
864
|
}
|
|
860
865
|
else if (e.shiftKey) {
|
|
861
866
|
this.redo();
|
|
@@ -1089,7 +1094,7 @@ export class Canvas {
|
|
|
1089
1094
|
img.onerror = (e) => {
|
|
1090
1095
|
reject(e);
|
|
1091
1096
|
};
|
|
1092
|
-
img.crossOrigin = 'anonymous';
|
|
1097
|
+
img.crossOrigin = this.store.options.crossOrigin || 'anonymous';
|
|
1093
1098
|
img.src = url;
|
|
1094
1099
|
});
|
|
1095
1100
|
}
|
|
@@ -4001,6 +4006,7 @@ export class Canvas {
|
|
|
4001
4006
|
const image64 = 'data:image/svg+xml;base64,' + svg64;
|
|
4002
4007
|
// set that as your image source
|
|
4003
4008
|
img.src = image64;
|
|
4009
|
+
img.crossOrigin = pen.crossOrigin || this.store.options.crossOrigin || 'anonymous';
|
|
4004
4010
|
// do your canvas work
|
|
4005
4011
|
img.onload = () => {
|
|
4006
4012
|
pen.calculative.img = img;
|
|
@@ -4044,7 +4050,7 @@ export class Canvas {
|
|
|
4044
4050
|
img.crossOrigin =
|
|
4045
4051
|
pen.crossOrigin === 'undefined'
|
|
4046
4052
|
? undefined
|
|
4047
|
-
: pen.crossOrigin || 'anonymous';
|
|
4053
|
+
: pen.crossOrigin || this.store.options.crossOrigin || 'anonymous';
|
|
4048
4054
|
img.src = pen.image;
|
|
4049
4055
|
if (this.store.options.cdn &&
|
|
4050
4056
|
!(pen.image.startsWith('http') ||
|
|
@@ -4080,7 +4086,7 @@ export class Canvas {
|
|
|
4080
4086
|
}
|
|
4081
4087
|
else {
|
|
4082
4088
|
const img = new Image();
|
|
4083
|
-
img.crossOrigin = 'anonymous';
|
|
4089
|
+
img.crossOrigin = pen.crossOrigin || this.store.options.crossOrigin || 'anonymous';
|
|
4084
4090
|
img.src = pen.backgroundImage;
|
|
4085
4091
|
if (this.store.options.cdn &&
|
|
4086
4092
|
!(pen.backgroundImage.startsWith('http') ||
|
|
@@ -4110,7 +4116,7 @@ export class Canvas {
|
|
|
4110
4116
|
}
|
|
4111
4117
|
else {
|
|
4112
4118
|
const img = new Image();
|
|
4113
|
-
img.crossOrigin = 'anonymous';
|
|
4119
|
+
img.crossOrigin = pen.crossOrigin || this.store.options.crossOrigin || 'anonymous';
|
|
4114
4120
|
img.src = pen.strokeImage;
|
|
4115
4121
|
if (this.store.options.cdn &&
|
|
4116
4122
|
!(pen.strokeImage.startsWith('http') ||
|
|
@@ -4142,7 +4148,7 @@ export class Canvas {
|
|
|
4142
4148
|
const promise = new Promise((resolve, reject) => {
|
|
4143
4149
|
if (!globalStore.htmlElements[src]) {
|
|
4144
4150
|
const img = new Image();
|
|
4145
|
-
img.crossOrigin = 'anonymous';
|
|
4151
|
+
img.crossOrigin = this.store.options.crossOrigin || 'anonymous';
|
|
4146
4152
|
// 处理 CDN 路径
|
|
4147
4153
|
if (this.store.options.cdn &&
|
|
4148
4154
|
!(src.startsWith('http') ||
|
|
@@ -4354,12 +4360,20 @@ export class Canvas {
|
|
|
4354
4360
|
return;
|
|
4355
4361
|
}
|
|
4356
4362
|
if (now - this.lastRender < this.store.options.interval) {
|
|
4363
|
+
if (this.store.options.interval > this.store.options.minFPSNumber && this.store.options.autoFPS) {
|
|
4364
|
+
this.store.options.interval--;
|
|
4365
|
+
this.store.options.animateInterval = this.store.options.interval;
|
|
4366
|
+
}
|
|
4357
4367
|
if (this.renderTimer) {
|
|
4358
4368
|
cancelAnimationFrame(this.renderTimer);
|
|
4359
4369
|
}
|
|
4360
4370
|
this.renderTimer = requestAnimationFrame(this.render);
|
|
4361
4371
|
return;
|
|
4362
4372
|
}
|
|
4373
|
+
else if (now - this.lastRender - this.store.options.interval > 10 && this.store.options.autoFPS && document.visibilityState === 'visible') {
|
|
4374
|
+
this.store.options.interval++;
|
|
4375
|
+
this.store.options.animateInterval = this.store.options.interval;
|
|
4376
|
+
}
|
|
4363
4377
|
this.renderTimer = undefined;
|
|
4364
4378
|
this.lastRender = now;
|
|
4365
4379
|
const offscreenCtx = this.offscreen.getContext('2d');
|
|
@@ -7183,6 +7197,7 @@ export class Canvas {
|
|
|
7183
7197
|
li.onmousedown = this.stopPropagation;
|
|
7184
7198
|
li.dataset.i = index + '';
|
|
7185
7199
|
li.onclick = this.selectDropdown;
|
|
7200
|
+
li.ontouchstart = this.selectDropdown;
|
|
7186
7201
|
const pen = this.store.pens[this.inputDiv.dataset.penId];
|
|
7187
7202
|
li.onmouseenter = () => {
|
|
7188
7203
|
li.style.background = pen.dropdownHoverBackground || this.store.styles["activeBg"] || '#eee';
|
|
@@ -7195,6 +7210,7 @@ export class Canvas {
|
|
|
7195
7210
|
this.dropdown.appendChild(li);
|
|
7196
7211
|
}
|
|
7197
7212
|
selectDropdown = (e) => {
|
|
7213
|
+
e.stopPropagation();
|
|
7198
7214
|
const li = e.target;
|
|
7199
7215
|
const pen = this.store.pens[this.inputDiv.dataset.penId];
|
|
7200
7216
|
if (!li || !pen || !pen.dropdownList) {
|