costy-plus 1.1.19-0 → 1.1.20-0
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.
|
@@ -4,7 +4,7 @@ import E from "../../node_modules/.pnpm/vue-class-component@7.2.6_vue@2.6.14/nod
|
|
|
4
4
|
import "../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Emit.js";
|
|
5
5
|
import { Prop as f } from "../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Prop.js";
|
|
6
6
|
import { Text as O, Group as Y, Rect as y, Circle as F, init as j } from "zrender";
|
|
7
|
-
import { calcMs as
|
|
7
|
+
import { calcMs as T, calcMV as $, calcBpm as k } from "@costy-plus/utils";
|
|
8
8
|
var S = Object.defineProperty, G = Object.getOwnPropertyDescriptor, l = (t, e, s, h) => {
|
|
9
9
|
for (var c = h > 1 ? void 0 : h ? G(e, s) : e, a = t.length - 1, i; a >= 0; a--)
|
|
10
10
|
(i = t[a]) && (c = (h ? i(e, s, c) : i(c)) || c);
|
|
@@ -60,7 +60,7 @@ let o = class extends C {
|
|
|
60
60
|
style: {
|
|
61
61
|
stroke: this.config.circleLinestroke,
|
|
62
62
|
lineWidth: this.config.circleLineW,
|
|
63
|
-
fill: "
|
|
63
|
+
fill: "transparent"
|
|
64
64
|
},
|
|
65
65
|
shape: {
|
|
66
66
|
width: 1,
|
|
@@ -74,7 +74,7 @@ let o = class extends C {
|
|
|
74
74
|
style: {
|
|
75
75
|
stroke: this.config.circleLinestroke,
|
|
76
76
|
lineWidth: this.config.circleLineW,
|
|
77
|
-
fill: "
|
|
77
|
+
fill: "transparent"
|
|
78
78
|
},
|
|
79
79
|
shape: {
|
|
80
80
|
r: 12
|
|
@@ -115,16 +115,16 @@ let o = class extends C {
|
|
|
115
115
|
}
|
|
116
116
|
calcText() {
|
|
117
117
|
var h, c, a, i, r, n, g, p;
|
|
118
|
-
const t =
|
|
118
|
+
const t = T(
|
|
119
119
|
((h = this.rectIns) == null ? void 0 : h.shape.width) || 0,
|
|
120
120
|
this.speedValue,
|
|
121
121
|
this.cellMg,
|
|
122
122
|
this.magnification
|
|
123
|
-
), e =
|
|
123
|
+
), e = $(
|
|
124
124
|
((c = this.rectIns) == null ? void 0 : c.shape.height) || 0,
|
|
125
125
|
this.sens,
|
|
126
126
|
this.magnification
|
|
127
|
-
), s = t !== 0 &&
|
|
127
|
+
), s = t !== 0 && k(t) || 0;
|
|
128
128
|
(p = this.textIns) == null || p.attr({
|
|
129
129
|
style: {
|
|
130
130
|
text: `${t} ms
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./style/index.css");const C=require("vue"),j=require("../../node_modules/.pnpm/vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-class-component/dist/vue-class-component.esm.js");require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Emit.js");const l=require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Prop.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./style/index.css");const C=require("vue"),j=require("../../node_modules/.pnpm/vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-class-component/dist/vue-class-component.esm.js");require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Emit.js");const l=require("../../node_modules/.pnpm/vue-property-decorator@9.1.2_vue-class-component@7.2.6_vue@2.6.14/node_modules/vue-property-decorator/lib/decorators/Prop.js"),f=require("zrender"),d=require("@costy-plus/utils"),E=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},O=E(C);var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,n=(t,e,s,h)=>{for(var c=h>1?void 0:h?Y(e,s):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(c=(h?i(e,s,c):i(c))||c);return h&&c&&X(e,s,c),c};exports.default=class extends O.default{constructor(){super(...arguments),this.sceneIns=Object.freeze(null),this.measuringRulerGroup=Object.freeze(null),this.rectIns=Object.freeze(null),this.textIns=Object.freeze(null),this.fontFamily=Object.freeze("\u5FAE\u8F6F\u96C5\u9ED1"),this.circleList=Object.freeze([]),this.isMouseDown=Object.freeze(!1),this.originReactPostion=Object.freeze([]),this.circleDragPos=Object.freeze({x:0,y:0})}destroyed(){var t,e;(t=this.measuringRulerGroup)==null||t.removeAll(),(e=this.sceneIns)==null||e.dispose()}created(){this.initConfig()}initConfig(){this.circleList=[],this.circleDragPos={x:0,y:0},this.textIns=new f.Text({style:{lineHeight:this.config.textFontSize+4,fontSize:this.config.textFontSize,fill:this.config.textColor,fontFamily:this.fontFamily,fontWeight:"bold"}}),this.measuringRulerGroup=new f.Group({name:"measuringRuler"}),this.rectIns=new f.Rect({name:"rect",style:{stroke:this.config.stroke,lineWidth:this.config.lineW,fill:"transparent"},shape:{x:0,y:0},cursor:"move",draggable:!0});let t;const e=["nw-resize","ne-resize","se-resize","sw-resize","n-resize","e-resize","s-resize","w-resize"];for(let s=0;s<8;s++)s>3?t=new f.Rect({name:`${s}_circle`,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{width:1,height:1},cursor:e[s],zlevel:1,draggable:!0}):t=new f.Circle({name:`${s}_circle`,style:{stroke:this.config.circleLinestroke,lineWidth:this.config.circleLineW,fill:"transparent"},shape:{r:12},cursor:e[s],zlevel:1,draggable:!0}),t.hide(),this.measuringRulerGroup.add(t),this.circleList.push(t);this.measuringRulerGroup.add(new f.Rect({name:"main-box",style:{fill:"transparent"},shape:{x:0,y:0,width:this.width,height:this.height},cursor:"crosshair"})),this.measuringRulerGroup.add(this.rectIns),this.measuringRulerGroup.add(this.textIns)}mounted(){this.init()}init(){var e;const t=document.getElementById(`${this.prefixId}mx-measuring-ruler`);this.sceneIns=f.init(t,{width:this.width,height:this.height,devicePixelRatio:2}),(e=this.sceneIns)==null||e.add(this.measuringRulerGroup),this.sceneAddToEventListener(),this.rectAddToEventListener(),this.circleAddToEventListener()}calcText(){var h,c,a,i,r,o,u,p;const t=d.calcMs(((h=this.rectIns)==null?void 0:h.shape.width)||0,this.speedValue,this.cellMg,this.magnification),e=d.calcMV(((c=this.rectIns)==null?void 0:c.shape.height)||0,this.sens,this.magnification),s=t!==0&&d.calcBpm(t)||0;(p=this.textIns)==null||p.attr({style:{text:`${t} ms
|
|
2
2
|
${s} bpm
|
|
3
|
-
${e} mV`,x:(((a=this.rectIns)==null?void 0:a.x)||0)+(((i=this.rectIns)==null?void 0:i.shape.x)||0)+(((r=this.rectIns)==null?void 0:r.shape.width)||0)+20,y:(((o=this.rectIns)==null?void 0:o.y)||0)+(((u=this.rectIns)==null?void 0:u.shape.y)||0)}})}circleHideOrShow(t){this.circleList.forEach(e=>t?e.show():e.hide())}sceneAddToEventListener(){var s,h,c,a,i;const t=r=>{r.event.preventDefault(),this.$emit("notifyMeasuringRuler",{name:"contextmenu"})},e=r=>{this.$emit("notifyMeasuringRuler",{name:"dblclick"})};(s=this.sceneIns)==null||s.on("contextmenu",t),(h=this.sceneIns)==null||h.on("mousedown",this.sceneMousedown),(c=this.sceneIns)==null||c.on("mousemove",this.scenemousemove),(a=this.sceneIns)==null||a.on("mouseup",this.scenemouseup),(i=this.sceneIns)==null||i.on("dblclick",e),this.$once("hook:beforeDestroy",()=>{var r,o,u,
|
|
3
|
+
${e} mV`,x:(((a=this.rectIns)==null?void 0:a.x)||0)+(((i=this.rectIns)==null?void 0:i.shape.x)||0)+(((r=this.rectIns)==null?void 0:r.shape.width)||0)+20,y:(((o=this.rectIns)==null?void 0:o.y)||0)+(((u=this.rectIns)==null?void 0:u.shape.y)||0)}})}circleHideOrShow(t){this.circleList.forEach(e=>t?e.show():e.hide())}sceneAddToEventListener(){var s,h,c,a,i;const t=r=>{r.event.preventDefault(),this.$emit("notifyMeasuringRuler",{name:"contextmenu"})},e=r=>{this.$emit("notifyMeasuringRuler",{name:"dblclick"})};(s=this.sceneIns)==null||s.on("contextmenu",t),(h=this.sceneIns)==null||h.on("mousedown",this.sceneMousedown),(c=this.sceneIns)==null||c.on("mousemove",this.scenemousemove),(a=this.sceneIns)==null||a.on("mouseup",this.scenemouseup),(i=this.sceneIns)==null||i.on("dblclick",e),this.$once("hook:beforeDestroy",()=>{var r,o,u,p,g;(r=this.sceneIns)==null||r.off("contextmenu",t),(o=this.sceneIns)==null||o.off("mousedown",this.sceneMousedown),(u=this.sceneIns)==null||u.off("mousemove",this.scenemousemove),(p=this.sceneIns)==null||p.off("mouseup",this.scenemouseup),(g=this.sceneIns)==null||g.off("dblclick",e)})}sceneRemoveEventListener(){var t,e,s;(t=this.sceneIns)==null||t.off("mousedown",this.sceneMousedown),(e=this.sceneIns)==null||e.off("mousemove",this.scenemousemove),(s=this.sceneIns)==null||s.off("mouseup",this.scenemouseup)}sceneMousedown(t){var e;this.isMouseDown=!0,(e=this.rectIns)==null||e.attr({shape:{x:t.offsetX,y:t.offsetY}})}scenemousemove(t){var e;!this.isMouseDown||(e=this.rectIns)==null||e.attr({shape:{width:t.offsetX-this.rectIns.shape.x,height:t.offsetY-this.rectIns.shape.y}})}scenemouseup(t){var e,s,h,c,a,i,r,o,u,p,g,y,x,m,I,L,w,v,b,D,P,_,z,R,M;this.isMouseDown=!1,(e=this.rectIns)==null||e.attr({shape:{width:t.offsetX-this.rectIns.shape.x,height:t.offsetY-this.rectIns.shape.y}}),this.circleList[0].attr({x:(s=this.rectIns)==null?void 0:s.shape.x,y:(h=this.rectIns)==null?void 0:h.shape.y}),this.circleList[1].attr({x:t.offsetX-(((c=this.rectIns)==null?void 0:c.shape.x)||0)+(((a=this.rectIns)==null?void 0:a.shape.x)||0),y:(i=this.rectIns)==null?void 0:i.shape.y}),this.circleList[2].attr({x:t.offsetX-(((r=this.rectIns)==null?void 0:r.shape.x)||0)+(((o=this.rectIns)==null?void 0:o.shape.x)||0),y:t.offsetY-(((u=this.rectIns)==null?void 0:u.shape.y)||0)+(((p=this.rectIns)==null?void 0:p.shape.y)||0)}),this.circleList[3].attr({x:(g=this.rectIns)==null?void 0:g.shape.x,y:t.offsetY-(((y=this.rectIns)==null?void 0:y.shape.y)||0)+(((x=this.rectIns)==null?void 0:x.shape.y)||0)}),this.circleList[4].attr({x:((m=this.rectIns)==null?void 0:m.shape.x)+12,y:((I=this.rectIns)==null?void 0:I.shape.y)-1,shape:{width:t.offsetX-this.rectIns.shape.x-24,height:2}}),this.circleList[5].attr({x:t.offsetX-(((L=this.rectIns)==null?void 0:L.shape.x)||0)+(((w=this.rectIns)==null?void 0:w.shape.x)||0)-1,y:((v=this.rectIns)==null?void 0:v.shape.y)+12,shape:{width:2,height:t.offsetY-((b=this.rectIns)==null?void 0:b.shape.y)-24}}),this.circleList[6].attr({x:((D=this.rectIns)==null?void 0:D.shape.x)+12,y:t.offsetY-(((P=this.rectIns)==null?void 0:P.shape.y)||0)+(((_=this.rectIns)==null?void 0:_.shape.y)||0)-1,shape:{width:t.offsetX-this.rectIns.shape.x-24,height:2}}),this.circleList[7].attr({x:((z=this.rectIns)==null?void 0:z.shape.x)-1,y:((R=this.rectIns)==null?void 0:R.shape.y)+12,shape:{width:2,height:t.offsetY-((M=this.rectIns)==null?void 0:M.shape.y)-24}}),this.calcText(),this.circleHideOrShow(!0),this.sceneRemoveEventListener()}rectAddToEventListener(){var t;(t=this.rectIns)==null||t.on("drag",this.rectDrag),this.$once("hook:beforeDestroy",()=>{var e;(e=this.rectIns)==null||e.on("drag",this.rectDrag)})}rectDrag(t){var e;if(t.offsetX<=5||t.offsetX>=this.width-5||t.offsetY<=5||t.offsetY>=this.height-5){(e=this.rectIns)==null||e.setPosition([this.originReactPostion[0],this.originReactPostion[1]]);return}this.originReactPostion=[t.target.x,t.target.y],this.circleList.forEach((s,h)=>{h>3?s.attr({shape:{x:t.target.x,y:t.target.y}}):s.attr({shape:{cx:t.target.x,cy:t.target.y}})}),this.calcText(),console.log("rectDrag--\u8FD9\u91CC")}circleAddToEventListener(){this.circleList.forEach(t=>{t.on("drag",this.circleDrag),t.on("dragstart",this.circleDragStart)}),this.$once("hook:beforeDestroy",()=>{this.circleList.forEach(t=>{t.off("drag",this.circleDrag),t.off("dragstart",this.circleDragStart)})})}circleDragStart(t){console.log("circleDragStart--\u8FD9\u91CC",t),this.circleDragPos.x=t.offsetX,this.circleDragPos.y=t.offsetY}circleDrag(t){var o;console.log("circleDrag--\u8FD9\u91CC",t);const e=parseInt(t.target.name);if(isNaN(e))return;const s=t.offsetX-this.circleDragPos.x,h=t.offsetY-this.circleDragPos.y;this.circleDragPos.x=t.offsetX,this.circleDragPos.y=t.offsetY;let c=this.rectIns.shape.x,a=this.rectIns.shape.y,i=this.rectIns.shape.width,r=this.rectIns.shape.height;console.log("moveX",s,h),e===0?(c+=s,a+=h,s<0?i+=-s:i-=s,h<0?r+=-h:r-=h,this.circleList[1].attr({y:t.target.y}),this.circleList[3].attr({x:t.target.x}),this.circleList[4].attr({x:t.target.x+12,y:t.target.y-1,shape:{width:i-24}}),this.circleList[7].attr({x:t.target.x-1,y:t.target.y+12,shape:{height:r-24}}),this.circleList[5].attr({y:t.target.y+12,shape:{height:r-24}}),this.circleList[6].attr({x:t.target.x+12,shape:{width:i-24}})):e===1?(a+=h,i+=s,h<0?r+=-h:r-=h,this.circleList[0].attr({y:t.target.y}),this.circleList[2].attr({x:t.target.x}),this.circleList[4].attr({x:t.target.x-i+12,y:t.target.y-1,shape:{width:i-24}}),this.circleList[5].attr({x:t.target.x-1,y:t.target.y+12,shape:{height:r-24}}),this.circleList[6].attr({shape:{width:i-24}}),this.circleList[7].attr({y:t.target.y+12,shape:{height:r-24}})):e===2?(i+=s,r+=h,this.circleList[3].attr({y:t.target.y}),this.circleList[1].attr({x:t.target.x}),this.circleList[5].attr({x:t.target.x-1,shape:{height:r-24}}),this.circleList[6].attr({y:t.target.y-1,shape:{width:i-24}}),this.circleList[4].attr({shape:{width:i-24}}),this.circleList[7].attr({shape:{height:r-24}})):e===3?(c+=s,s<0?i+=-s:i-=s,r+=h,this.circleList[2].attr({y:t.target.y}),this.circleList[0].attr({x:t.target.x}),this.circleList[6].attr({x:t.target.x+12,y:t.target.y-1,shape:{width:i-24}}),this.circleList[7].attr({x:t.target.x-1,shape:{height:r-24}}),this.circleList[4].attr({x:t.target.x+12,shape:{width:i-24}}),this.circleList[5].attr({shape:{height:r-24}})):e===4?(a+=h,h<0?r+=-h:r-=h,this.circleList[0].attr({y:t.target.y+1}),this.circleList[1].attr({y:t.target.y+1}),this.circleList[5].attr({y:t.target.y+12,shape:{height:r-24}}),this.circleList[7].attr({y:t.target.y+12,shape:{height:r-24}}),this.circleList[4].attr({x:c+12})):e===5?(i+=s,this.circleList[1].attr({x:t.target.x+1}),this.circleList[2].attr({x:t.target.x+1}),this.circleList[4].attr({shape:{width:i-24}}),this.circleList[6].attr({shape:{width:i-24}}),this.circleList[5].attr({y:a+12})):e===6?(r+=h,this.circleList[2].attr({y:t.target.y+1}),this.circleList[3].attr({y:t.target.y+1}),this.circleList[5].attr({shape:{height:r-24}}),this.circleList[7].attr({shape:{height:r-24}}),this.circleList[6].attr({x:c+12})):e===7&&(c+=s,s<0?i+=-s:i-=s,this.circleList[0].attr({x:t.target.x+1}),this.circleList[3].attr({x:t.target.x+1}),this.circleList[4].attr({x:t.target.x+12,shape:{width:i-24}}),this.circleList[6].attr({x:t.target.x+12,shape:{width:i-24}}),this.circleList[7].attr({y:a+12})),(o=this.rectIns)==null||o.attr({shape:{x:c,y:a,width:i,height:r}}),this.calcText()}};n([l.Prop({default:()=>""})],exports.default.prototype,"prefixId",2);n([l.Prop({required:!0,type:Number,validator:t=>typeof t=="number"})],exports.default.prototype,"width",2);n([l.Prop({required:!0,type:Number,validator:t=>typeof t=="number"})],exports.default.prototype,"height",2);n([l.Prop({default:()=>({lineW:1,stroke:"#00C800",circleLineW:1,circleLinestroke:"blue",textColor:"#000",textFontSize:12})})],exports.default.prototype,"config",2);n([l.Prop({required:!0})],exports.default.prototype,"speedValue",2);n([l.Prop({required:!0})],exports.default.prototype,"cellMg",2);n([l.Prop({default:1})],exports.default.prototype,"magnification",2);n([l.Prop({default:1})],exports.default.prototype,"sens",2);n([l.Prop({default:()=>""})],exports.default.prototype,"className",2);exports.default=n([j.default({name:"MXMeasuringRuler"})],exports.default);
|