@meta2d/core 1.0.3 → 1.0.4
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 +41 -6
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +1 -0
- package/src/core.js.map +1 -1
- package/src/options.d.ts +1 -0
- package/src/options.js +1 -0
- package/src/options.js.map +1 -1
- package/src/pen/render.js +10 -0
- package/src/pen/render.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -237,6 +237,25 @@ var Canvas = /** @class */ (function () {
|
|
|
237
237
|
}
|
|
238
238
|
e.preventDefault();
|
|
239
239
|
e.stopPropagation();
|
|
240
|
+
//禁止触摸屏双指缩放操作
|
|
241
|
+
if (_this.store.options.disableTouchPadScale &&
|
|
242
|
+
e.ctrlKey &&
|
|
243
|
+
e.deltaY !== 0) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
//window触控板只允许平移 触摸屏一般不超过100
|
|
247
|
+
var isWin = navigator.userAgent.indexOf('Win') !== -1;
|
|
248
|
+
if (isWin && !e.ctrlKey && Math.abs(e.deltaY) < 100) {
|
|
249
|
+
_this.translate(-e.deltaX, -e.deltaY);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
//mac触控板只允许平移(排除普通鼠标的情况)
|
|
253
|
+
var isMac = /macintosh|mac os x/i.test(navigator.userAgent) ||
|
|
254
|
+
navigator.platform.indexOf('Mac') !== -1;
|
|
255
|
+
if (isMac && !e.ctrlKey && e.wheelDeltaY % 240 !== 0) {
|
|
256
|
+
_this.translate(-e.deltaX, -e.deltaY);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
240
259
|
if (_this.store.options.scroll && !e.ctrlKey && !e.metaKey && _this.scroll) {
|
|
241
260
|
_this.scroll.wheel(e.deltaY < 0);
|
|
242
261
|
return;
|
|
@@ -542,6 +561,20 @@ var Canvas = /** @class */ (function () {
|
|
|
542
561
|
_this.store.options.disableAnchor = !_this.store.options.disableAnchor;
|
|
543
562
|
_this.store.emitter.emit('disableAnchor', _this.store.options.disableAnchor);
|
|
544
563
|
break;
|
|
564
|
+
case '=':
|
|
565
|
+
if (e.ctrlKey || e.metaKey) {
|
|
566
|
+
_this.scale(_this.store.data.scale + 0.1);
|
|
567
|
+
e.preventDefault();
|
|
568
|
+
e.stopPropagation();
|
|
569
|
+
}
|
|
570
|
+
break;
|
|
571
|
+
case '-':
|
|
572
|
+
if (e.ctrlKey || e.metaKey) {
|
|
573
|
+
_this.scale(_this.store.data.scale - 0.1);
|
|
574
|
+
e.preventDefault();
|
|
575
|
+
e.stopPropagation();
|
|
576
|
+
}
|
|
577
|
+
break;
|
|
545
578
|
}
|
|
546
579
|
_this.render(false);
|
|
547
580
|
};
|
|
@@ -779,7 +812,7 @@ var Canvas = /** @class */ (function () {
|
|
|
779
812
|
}
|
|
780
813
|
//shift 快捷添加锚点并连线
|
|
781
814
|
if (!_this.store.options.autoAnchor && !_this.drawingLine) {
|
|
782
|
-
if (e.shiftKey) {
|
|
815
|
+
if (e.shiftKey && !e.ctrlKey) {
|
|
783
816
|
_this.setAnchor(_this.store.pointAt);
|
|
784
817
|
_this.drawingLineName = _this.store.options.drawingLineName;
|
|
785
818
|
var anchor = _this.store.activeAnchor;
|
|
@@ -2310,7 +2343,7 @@ var Canvas = /** @class */ (function () {
|
|
|
2310
2343
|
: pen.textHeight * font_scale) + "px;";
|
|
2311
2344
|
}
|
|
2312
2345
|
else {
|
|
2313
|
-
var tem = pen.height / scale - (pen.textTop || 0);
|
|
2346
|
+
var tem = pen.calculative.worldRect.height / scale - (pen.textTop || 0);
|
|
2314
2347
|
if (tem < 0) {
|
|
2315
2348
|
tem = 0;
|
|
2316
2349
|
}
|
|
@@ -2357,8 +2390,10 @@ var Canvas = /** @class */ (function () {
|
|
|
2357
2390
|
}
|
|
2358
2391
|
if (pen.whiteSpace !== 'nowrap') {
|
|
2359
2392
|
var textWidth = pen.fontSize * 1.2 * pen.text.length;
|
|
2360
|
-
var contentWidth = (pen.textWidth || pen.width / scale) *
|
|
2361
|
-
Math.floor(pen.height /
|
|
2393
|
+
var contentWidth = (pen.textWidth || pen.calculative.worldRect.width / scale) *
|
|
2394
|
+
Math.floor(pen.calculative.worldRect.height /
|
|
2395
|
+
scale /
|
|
2396
|
+
(pen.lineHeight * pen.fontSize));
|
|
2362
2397
|
if (textWidth > contentWidth) {
|
|
2363
2398
|
style += 'justify-content: start;';
|
|
2364
2399
|
}
|
|
@@ -4638,7 +4673,7 @@ var Canvas = /** @class */ (function () {
|
|
|
4638
4673
|
return;
|
|
4639
4674
|
}
|
|
4640
4675
|
var initPens = !doing && deepClone(pens, true);
|
|
4641
|
-
translateRect(this.activeRect, x, y);
|
|
4676
|
+
this.activeRect && translateRect(this.activeRect, x, y);
|
|
4642
4677
|
var containChildPens = this.getAllByPens(pens);
|
|
4643
4678
|
pens.forEach(function (pen) {
|
|
4644
4679
|
var _a, _b;
|
|
@@ -4677,7 +4712,7 @@ var Canvas = /** @class */ (function () {
|
|
|
4677
4712
|
_this.updateLines(pen);
|
|
4678
4713
|
(_b = pen.onMove) === null || _b === void 0 ? void 0 : _b.call(pen, pen);
|
|
4679
4714
|
});
|
|
4680
|
-
this.getSizeCPs();
|
|
4715
|
+
this.activeRect && this.getSizeCPs();
|
|
4681
4716
|
this.render();
|
|
4682
4717
|
this.tooltip.translate(x, y);
|
|
4683
4718
|
if (!doing) {
|