@meta2d/core 1.1.4 → 1.1.6

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 CHANGED
@@ -1,40 +1,40 @@
1
- {
2
- "name": "@meta2d/core",
3
- "version": "1.1.4",
4
- "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "scripts": {
8
- "copy": "copyfiles package.json ../../dist/core/",
9
- "build": "tsc && npm run copy"
10
- },
11
- "keywords": [
12
- "meta2d",
13
- "diagram",
14
- "2D",
15
- "canvas"
16
- ],
17
- "author": "alsmile123@qq.com",
18
- "license": "MIT",
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/le5le-com/meta2d.js.git"
22
- },
23
- "bugs": {
24
- "url": "https://github.com/le5le-com/meta2d.js/issues"
25
- },
26
- "homepage": "https://github.com/le5le-com/meta2d.js#readme",
27
- "devDependencies": {
28
- "@types/marked": "^4.0.3",
29
- "@types/offscreencanvas": "latest",
30
- "@types/zrender": "^4.0.0"
31
- },
32
- "dependencies": {
33
- "mitt": "^2.1.0",
34
- "mqtt": "^4.2.6"
35
- },
36
- "publishConfig": {
37
- "access": "public"
38
- },
39
- "gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14"
40
- }
1
+ {
2
+ "name": "@meta2d/core",
3
+ "version": "1.1.6",
4
+ "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "scripts": {
8
+ "copy": "copyfiles package.json ../../dist/core/",
9
+ "build": "tsc && npm run copy"
10
+ },
11
+ "keywords": [
12
+ "meta2d",
13
+ "diagram",
14
+ "2D",
15
+ "canvas"
16
+ ],
17
+ "author": "alsmile123@qq.com",
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/le5le-com/meta2d.js.git"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/le5le-com/meta2d.js/issues"
25
+ },
26
+ "homepage": "https://github.com/le5le-com/meta2d.js#readme",
27
+ "devDependencies": {
28
+ "@types/marked": "^4.0.3",
29
+ "@types/offscreencanvas": "latest",
30
+ "@types/zrender": "^4.0.0"
31
+ },
32
+ "dependencies": {
33
+ "mitt": "^2.1.0",
34
+ "mqtt": "^4.2.6"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "gitHead": "78f2a53ca1839c89b56e2e498d17ba4eb987ad14"
40
+ }
@@ -181,9 +181,16 @@ export class Canvas {
181
181
  this.externalElements.ondrop = this.ondrop;
182
182
  this.externalElements.oncontextmenu = (e) => e.preventDefault();
183
183
  this.store.options.interval = 50;
184
- this.externalElements.ontouchstart = this.ontouchstart;
185
- this.externalElements.ontouchmove = this.ontouchmove;
186
- this.externalElements.ontouchend = this.ontouchend;
184
+ if (this.store.options.parentTouch) {
185
+ this.parentElement.ontouchstart = this.ontouchstart;
186
+ this.parentElement.ontouchmove = this.ontouchmove;
187
+ this.parentElement.ontouchend = this.ontouchend;
188
+ }
189
+ else {
190
+ this.externalElements.ontouchstart = this.ontouchstart;
191
+ this.externalElements.ontouchmove = this.ontouchmove;
192
+ this.externalElements.ontouchend = this.ontouchend;
193
+ }
187
194
  this.externalElements.onmousedown = (e) => {
188
195
  if (this.isMobile) {
189
196
  return;
@@ -1390,6 +1397,7 @@ export class Canvas {
1390
1397
  buttons: 1,
1391
1398
  });
1392
1399
  if (e.touches.length === 2) {
1400
+ this.mouseDown = undefined;
1393
1401
  this.initTouchDis = Math.hypot(e.touches[0].pageX - e.touches[1].pageX, e.touches[0].pageY - e.touches[1].pageY);
1394
1402
  this.initScale = this.store.data.scale;
1395
1403
  this.startTouches = e.touches;
@@ -1457,16 +1465,17 @@ export class Canvas {
1457
1465
  });
1458
1466
  }
1459
1467
  else if (len === 2 && this.startTouches?.length === 2) {
1468
+ this.mouseDown = undefined;
1460
1469
  if (!this.touchMoving && !this.touchScaling) {
1461
1470
  const x1 = this.startTouches[0].pageX - touches[0].pageX;
1462
1471
  const x2 = this.startTouches[1].pageX - touches[1].pageX;
1463
1472
  const y1 = this.startTouches[0].pageY - touches[0].pageY;
1464
1473
  const y2 = this.startTouches[1].pageY - touches[1].pageY;
1465
- if (((x1 >= 0 && x2 < 0) || (x1 <= 0 && x2 > 0)) &&
1466
- ((y1 >= 0 && y2 < 0) || (y1 <= 0 && y2 > 0))) {
1474
+ if ((((x1 >= 0 && x2 < 0) || (x1 <= 0 && x2 > 0)) &&
1475
+ ((y1 >= 0 && y2 < 0) || (y1 <= 0 && y2 > 0))) || (x2 == 0 && y2 == 0) || (x1 == 0 && y1 == 0)) {
1467
1476
  this.touchScaling = true;
1468
1477
  }
1469
- else {
1478
+ else if (y1 * y2 > 0 && x1 * x2 > 0) {
1470
1479
  this.touchMoving = true;
1471
1480
  }
1472
1481
  }
@@ -6833,8 +6842,8 @@ export class Canvas {
6833
6842
  }
6834
6843
  sheet.deleteRule(0);
6835
6844
  sheet.deleteRule(0);
6836
- sheet.insertRule(`.meta2d-input
6837
- .input-div{
6845
+ sheet.insertRule(`.meta2d-input
6846
+ .input-div{
6838
6847
  resize:none;border:none;outline:none;background:transparent;position:absolute;flex-grow:1;height:100%;width: 100%;position:absolute;left:0;top:0;display:flex;flex-direction: column;cursor: text;${style}}`);
6839
6848
  sheet.insertRule(`.input-div div{${div_style}}`);
6840
6849
  // sheet.insertRule(`.meta2d-input .input-div-font{${style_font}}`);
@@ -8170,9 +8179,16 @@ export class Canvas {
8170
8179
  this.externalElements.removeEventListener('gesturestart', this.onGesturestart);
8171
8180
  this.externalElements.ondragover = (e) => e.preventDefault();
8172
8181
  this.externalElements.ondrop = undefined;
8173
- this.externalElements.ontouchstart = undefined;
8174
- this.externalElements.ontouchmove = undefined;
8175
- this.externalElements.ontouchend = undefined;
8182
+ if (this.store.options.parentTouch) {
8183
+ this.parentElement.ontouchstart = undefined;
8184
+ this.parentElement.ontouchmove = undefined;
8185
+ this.parentElement.ontouchend = undefined;
8186
+ }
8187
+ else {
8188
+ this.externalElements.ontouchstart = undefined;
8189
+ this.externalElements.ontouchmove = undefined;
8190
+ this.externalElements.ontouchend = undefined;
8191
+ }
8176
8192
  this.externalElements.onmousedown = undefined;
8177
8193
  this.externalElements.onmousemove = undefined;
8178
8194
  this.externalElements.onmouseup = undefined;