@evercam/ui 1.0.0-preview-fix-timeline-labels-b5096fc7b → 1.0.0-preview-addingZoomToAreaSelector-d22180b4f

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.
@@ -17,6 +17,9 @@ declare const _default: import("vue/types/vue").ExtendedVue<Vue<Record<string, a
17
17
  left: number;
18
18
  top: number;
19
19
  };
20
+ mouseDownX: number;
21
+ mouseDownY: number;
22
+ dragThreshold: number;
20
23
  }, {
21
24
  onResize(): void;
22
25
  getRelativePosition(event: MouseEvent): {
@@ -34,6 +37,10 @@ declare const _default: import("vue/types/vue").ExtendedVue<Vue<Record<string, a
34
37
  distanceToLineSegment(p1: Point, p2: Point, p: Point): number;
35
38
  saveSelection(): void;
36
39
  }, {
40
+ scaledNodeSize: number;
41
+ scaledStrokeWidth: number;
42
+ scaledStrokeDasharray: string;
43
+ scaledThinStrokeWidth: number;
37
44
  controlsStyles: Record<string, string>;
38
45
  polygonPosition: {
39
46
  left: number;
package/dist/index.d.ts CHANGED
@@ -1324,6 +1324,9 @@ export declare const components: {
1324
1324
  left: number;
1325
1325
  top: number;
1326
1326
  };
1327
+ mouseDownX: number;
1328
+ mouseDownY: number;
1329
+ dragThreshold: number;
1327
1330
  }, {
1328
1331
  onResize(): void;
1329
1332
  getRelativePosition(event: MouseEvent): {
@@ -1341,6 +1344,10 @@ export declare const components: {
1341
1344
  distanceToLineSegment(p1: import('./types').Point, p2: import('./types').Point, p: import('./types').Point): number;
1342
1345
  saveSelection(): void;
1343
1346
  }, {
1347
+ scaledNodeSize: number;
1348
+ scaledStrokeWidth: number;
1349
+ scaledStrokeDasharray: string;
1350
+ scaledThinStrokeWidth: number;
1344
1351
  controlsStyles: Record<string, string>;
1345
1352
  polygonPosition: {
1346
1353
  left: number;
package/dist/index.mjs CHANGED
@@ -21968,10 +21968,31 @@ const bd = Cd.exports, xd = F.extend({
21968
21968
  strokeDasharray: "5,5",
21969
21969
  width: null,
21970
21970
  height: null,
21971
- containerRect: {}
21971
+ containerRect: {},
21972
+ mouseDownX: null,
21973
+ mouseDownY: null,
21974
+ dragThreshold: 5
21972
21975
  };
21973
21976
  },
21974
21977
  computed: {
21978
+ scaledNodeSize() {
21979
+ return Math.max(4, this.nodeSize / this.scale);
21980
+ },
21981
+ scaledStrokeWidth() {
21982
+ return Math.max(1, 2 / this.scale);
21983
+ },
21984
+ scaledStrokeDasharray() {
21985
+ if (!this.strokeDasharray || !this.scale)
21986
+ return this.strokeDasharray;
21987
+ const t = 2, e = 12;
21988
+ return this.strokeDasharray.split(",").map((r) => {
21989
+ const n = Number(r) / this.scale;
21990
+ return Math.max(t, Math.min(e, n));
21991
+ }).join(",");
21992
+ },
21993
+ scaledThinStrokeWidth() {
21994
+ return 1 / this.scale;
21995
+ },
21975
21996
  controlsStyles() {
21976
21997
  const t = this.polygonPosition;
21977
21998
  if (!t)
@@ -22048,7 +22069,7 @@ const bd = Cd.exports, xd = F.extend({
22048
22069
  },
22049
22070
  handleMouseDown(t) {
22050
22071
  const e = this.$refs.container, r = e.getBoundingClientRect();
22051
- e.contains(t.target) && this.isRectangle && (this.points = [], this.startX = (t.clientX - r.left) / this.scale, this.startY = (t.clientY - r.top) / this.scale, this.currentX = this.startX, this.currentY = this.startY, this.isMouseDown = !0);
22072
+ e.contains(t.target) && (this.mouseDownX = t.clientX, this.mouseDownY = t.clientY, this.isRectangle && (this.points = [], this.startX = (t.clientX - r.left) / this.scale, this.startY = (t.clientY - r.top) / this.scale, this.currentX = this.startX, this.currentY = this.startY, this.isMouseDown = !0));
22052
22073
  },
22053
22074
  handleMouseMove(t) {
22054
22075
  const { x: e, y: r } = this.getRelativePosition(t);
@@ -22062,14 +22083,14 @@ const bd = Cd.exports, xd = F.extend({
22062
22083
  const { x: e, y: r, container: n } = this.getRelativePosition(t);
22063
22084
  if (this.isRectangle && this.isMouseDown) {
22064
22085
  this.isMouseDown = !1;
22065
- const s = Math.min(this.startY, this.currentY), i = Math.min(this.startX, this.currentX), a = Math.max(this.startX, this.currentX), c = Math.max(this.startY, this.currentY);
22066
- if (i === a || s === c)
22086
+ const a = Math.min(this.startY, this.currentY), c = Math.min(this.startX, this.currentX), o = Math.max(this.startX, this.currentX), l = Math.max(this.startY, this.currentY);
22087
+ if (c === o || a === l)
22067
22088
  return;
22068
22089
  this.points = [
22069
- { x: i, y: s },
22070
- { x: a, y: s },
22071
- { x: a, y: c },
22072
- { x: i, y: c }
22090
+ { x: c, y: a },
22091
+ { x: o, y: a },
22092
+ { x: o, y: l },
22093
+ { x: c, y: l }
22073
22094
  ];
22074
22095
  return;
22075
22096
  }
@@ -22077,7 +22098,10 @@ const bd = Cd.exports, xd = F.extend({
22077
22098
  this.isDraggingPoint = !1, this.draggingPointIndex = -1;
22078
22099
  return;
22079
22100
  }
22080
- n.contains(t.target) && this.insertPoint({ x: e, y: r });
22101
+ if (!n.contains(t.target))
22102
+ return;
22103
+ const s = Math.abs(t.clientX - this.mouseDownX), i = Math.abs(t.clientY - this.mouseDownY);
22104
+ s > this.dragThreshold || i > this.dragThreshold || this.insertPoint({ x: e, y: r });
22081
22105
  },
22082
22106
  removePoint(t) {
22083
22107
  this.points.splice(t, 1);
@@ -22127,8 +22151,8 @@ var wd = function() {
22127
22151
  }, click: function(a) {
22128
22152
  return a.stopPropagation(), e.$emit("polygon-select", i);
22129
22153
  } } });
22130
- }), r("text", [e._v("test")])], 2) : r("svg", { staticClass: "polygon-overlay" }, [e.useMask && e.points.length > 2 ? [r("defs", [r("mask", { attrs: { id: "polygon-mask" } }, [r("rect", { attrs: { width: "100%", height: "100%", fill: "white" } }), r("polygon", { attrs: { points: e.polygonPoints, fill: "black" } })]), r("mask", { attrs: { id: "stroke-mask" } }, [r("rect", { attrs: { width: "100%", height: "100%", fill: "white" } }), r("polygon", { attrs: { points: e.polygonPoints, fill: "black" } })])]), r("rect", { attrs: { width: "100%", height: "100%", fill: "rgba(0,0,0,0.5)", mask: "url(#polygon-mask)" } }), r("polygon", { staticStyle: { filter: "blur(4px)" }, attrs: { points: e.polygonPoints, fill: "none", stroke: "#029eff", "stroke-width": "1", mask: "url(#stroke-mask)" } }, [r("animate", { attrs: { attributeName: "opacity", values: "0.67;0.8;0.67", dur: "1.5s", repeatCount: "indefinite" } }), r("animate", { attrs: { attributeName: "stroke-width", values: "1;6;1", dur: "1.5s", repeatCount: "indefinite" } })])] : e._e(), e.points.length > 2 ? r("polygon", { staticStyle: { animation: "border-dance 1s infinite linear" }, attrs: { points: e.polygonPoints, fill: e.useMask ? "transparent" : e.fillColor, stroke: e.lineColor, "stroke-width": "2", "stroke-dasharray": e.strokeDasharray } }) : e._e(), e.points.length === 2 ? r("line", { attrs: { x1: e.points[0].x, y1: e.points[0].y, x2: e.points[1].x, y2: e.points[1].y, stroke: e.lineColor, "stroke-width": "2", "stroke-dasharray": e.strokeDasharray } }) : e._e(), e._l(e.points, function(s, i) {
22131
- return r("circle", { directives: [{ name: "show", rawName: "v-show", value: !e.isReadOnly, expression: "!isReadOnly" }], key: i, staticClass: "polygon-point", attrs: { cx: s.x, cy: s.y, r: e.nodeSize, fill: e.lineColor, stroke: "white", "stroke-width": "2" }, on: { click: function(a) {
22154
+ }), r("text", [e._v("test")])], 2) : r("svg", { staticClass: "polygon-overlay" }, [e.useMask && e.points.length > 2 ? [r("defs", [r("mask", { attrs: { id: "polygon-mask" } }, [r("rect", { attrs: { width: "100%", height: "100%", fill: "white" } }), r("polygon", { attrs: { points: e.polygonPoints, fill: "black" } })]), r("mask", { attrs: { id: "stroke-mask" } }, [r("rect", { attrs: { width: "100%", height: "100%", fill: "white" } }), r("polygon", { attrs: { points: e.polygonPoints, fill: "black" } })])]), r("rect", { attrs: { width: "100%", height: "100%", fill: "rgba(0,0,0,0.5)", mask: "url(#polygon-mask)" } }), r("polygon", { staticStyle: { filter: "blur(4px)" }, attrs: { points: e.polygonPoints, fill: "none", stroke: "#029eff", "stroke-width": "1", mask: "url(#stroke-mask)" } }, [r("animate", { attrs: { attributeName: "opacity", values: "0.67;0.8;0.67", dur: "1.5s", repeatCount: "indefinite" } }), r("animate", { attrs: { attributeName: "stroke-width", values: "1;6;1", dur: "1.5s", repeatCount: "indefinite" } })])] : e._e(), e.points.length > 2 ? r("polygon", { staticStyle: { animation: "border-dance 1s infinite linear" }, attrs: { points: e.polygonPoints, fill: e.useMask ? "transparent" : e.fillColor, stroke: e.lineColor, "stroke-width": e.scaledStrokeWidth, "stroke-dasharray": e.scaledStrokeDasharray } }) : e._e(), e.points.length === 2 ? r("line", { attrs: { x1: e.points[0].x, y1: e.points[0].y, x2: e.points[1].x, y2: e.points[1].y, stroke: e.lineColor, "stroke-width": e.scaledStrokeWidth, "stroke-dasharray": e.strokeDasharray } }) : e._e(), e._l(e.points, function(s, i) {
22155
+ return r("circle", { key: i, staticClass: "polygon-point", attrs: { cx: s.x, cy: s.y, r: e.scaledNodeSize, fill: e.lineColor, stroke: "white", "stroke-width": e.scaledStrokeWidth }, on: { click: function(a) {
22132
22156
  return a.shiftKey ? e.removePoint(i) : null;
22133
22157
  }, mousedown: function(a) {
22134
22158
  return a.stopPropagation(), e.startDraggingPoint(a, i);