@labelbee/lb-annotation 1.13.0-alpha.7 → 1.14.0-alpha.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.
Files changed (59) hide show
  1. package/dist/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -0
  2. package/dist/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -0
  3. package/dist/assets/attributeIcon/icon_cuboidMore.svg.js +5 -0
  4. package/dist/assets/attributeIcon/icon_cuboidRight.svg.js +5 -0
  5. package/dist/assets/attributeIcon/icon_cuboidTop.svg.js +12 -0
  6. package/dist/constant/annotation.js +1 -1
  7. package/dist/constant/tool.js +1 -1
  8. package/dist/core/pointCloud/annotation.js +1 -1
  9. package/dist/core/pointCloud/index.js +2 -2
  10. package/dist/core/scheduler.js +1 -1
  11. package/dist/core/toolOperation/ViewOperation.js +1 -1
  12. package/dist/core/toolOperation/basicToolOperation.js +1 -1
  13. package/dist/core/toolOperation/cuboidOperation.js +1 -0
  14. package/dist/core/toolOperation/cuboidToggleButtonClass.js +31 -0
  15. package/dist/types/constant/annotation.d.ts +45 -1
  16. package/dist/types/constant/tool.d.ts +6 -1
  17. package/dist/types/core/index.d.ts +1 -2
  18. package/dist/types/core/pointCloud/annotation.d.ts +11 -1
  19. package/dist/types/core/pointCloud/index.d.ts +11 -1
  20. package/dist/types/core/pointCloud/matrix.d.ts +1 -0
  21. package/dist/types/core/scheduler.d.ts +7 -2
  22. package/dist/types/core/toolOperation/ViewOperation.d.ts +3 -2
  23. package/dist/types/core/toolOperation/basicToolOperation.d.ts +11 -1
  24. package/dist/types/core/toolOperation/cuboidOperation.d.ts +155 -0
  25. package/dist/types/core/toolOperation/cuboidToggleButtonClass.d.ts +38 -0
  26. package/dist/types/utils/MathUtils.d.ts +1 -1
  27. package/dist/types/utils/tool/AttributeUtils.d.ts +7 -0
  28. package/dist/types/utils/tool/AxisUtils.d.ts +50 -1
  29. package/dist/types/utils/tool/CuboidUtils.d.ts +267 -0
  30. package/dist/types/utils/tool/DrawUtils.d.ts +12 -0
  31. package/dist/types/utils/tool/EnhanceCommonToolUtils.d.ts +4 -2
  32. package/dist/types/utils/tool/PolygonUtils.d.ts +5 -2
  33. package/dist/utils/MathUtils.js +2 -2
  34. package/dist/utils/tool/AttributeUtils.js +1 -1
  35. package/dist/utils/tool/AxisUtils.js +1 -1
  36. package/dist/utils/tool/CuboidUtils.js +1 -0
  37. package/dist/utils/tool/DrawUtils.js +3 -3
  38. package/dist/utils/tool/EnhanceCommonToolUtils.js +1 -1
  39. package/es/assets/attributeIcon/icon_cuboidFAB.svg.js +5 -3
  40. package/es/assets/attributeIcon/icon_cuboidLeft.svg.js +7 -3
  41. package/es/assets/attributeIcon/icon_cuboidMore.svg.js +5 -3
  42. package/es/assets/attributeIcon/icon_cuboidRight.svg.js +5 -3
  43. package/es/assets/attributeIcon/icon_cuboidTop.svg.js +12 -3
  44. package/es/constant/annotation.js +1 -1
  45. package/es/constant/tool.js +1 -1
  46. package/es/core/pointCloud/annotation.js +1 -1
  47. package/es/core/pointCloud/index.js +2 -2
  48. package/es/core/scheduler.js +1 -1
  49. package/es/core/toolOperation/ViewOperation.js +1 -1
  50. package/es/core/toolOperation/basicToolOperation.js +1 -1
  51. package/es/core/toolOperation/cuboidOperation.js +1 -733
  52. package/es/core/toolOperation/cuboidToggleButtonClass.js +7 -150
  53. package/es/utils/MathUtils.js +2 -2
  54. package/es/utils/tool/AttributeUtils.js +1 -1
  55. package/es/utils/tool/AxisUtils.js +1 -1
  56. package/es/utils/tool/CuboidUtils.js +1 -663
  57. package/es/utils/tool/DrawUtils.js +3 -3
  58. package/es/utils/tool/EnhanceCommonToolUtils.js +1 -1
  59. package/package.json +3 -3
@@ -1,3 +1,3 @@
1
- import{ELineTypes as x,SEGMENT_NUMBER as P,DEFAULT_FONT as S}from"../../constant/tool.js";import m from"./PolygonUtils.js";import T from"./UnitUtils.js";var _=Object.defineProperty,E=Object.defineProperties,k=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,A=(y,r,t)=>r in y?_(y,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):y[r]=t,F=(y,r)=>{for(var t in r||(r={}))O.call(r,t)&&A(y,t,r[t]);if(v)for(var t of v(r))D.call(r,t)&&A(y,t,r[t]);return y},W=(y,r)=>E(y,k(r));const M=1,I={x:0,y:0},R=0,w="";class b{static drawLine(r,t,l,o={}){const e=r.getContext("2d"),{color:s=w,thickness:n=1,lineCap:c="round",lineDash:a}=o;e.save(),e.strokeStyle=s,e.lineWidth=n,e.lineCap=c,a&&e.setLineDash(a),e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(l.x+1,l.y+1),e.stroke(),e.restore()}static drawRect(r,t,l={}){const o=r.getContext("2d"),{color:e=w,thickness:s=1,lineCap:n="round",hiddenText:c=!1,lineDash:a}=l;if(o.save(),o.strokeStyle=e,o.lineWidth=s,o.lineCap=n,Array.isArray(a)&&o.setLineDash(a),o.fillStyle=e,o.strokeRect(t.x,t.y,t.width,t.height),c===!1){let i="";if(t.attribute&&(i=`${i} ${t.attribute}`),this.drawText(r,{x:t.x,y:t.y-5},i),t.textAttribute){const d=`${~~t.width} * ${~~t.height}`.length*7,g=0,u=Math.max(20,t.width-d);this.drawText(r,{x:t.x,y:t.y+t.height+20+g},t.textAttribute,{textMaxWidth:u})}}o.restore()}static drawRectWithFill(r,t,l={}){const o=r.getContext("2d"),{color:e=w}=l;o.save(),o.fillStyle=e,o.fillRect(t.x,t.y,t.width,t.height),o.restore()}static drawTagByDom(r,t,l){const o=r;if(!((t==null?void 0:t.length)>0))return;const e=document.createElement("div");return e.innerHTML=t,e.setAttribute("id",l),o==null||o.appendChild(e),e}static drawTag(r,t){var l;const o=r==null?void 0:r.parentNode,e=window.self.document.getElementById("tagToolTag");if(e&&o&&o.contains(e)&&(o==null||o.removeChild(e)),!((t==null?void 0:t.length)>0))return;const s=document.createElement("div");return s.innerHTML=(l=t.reduce((n,c)=>`${n}${c.keyName}: ${c.value.join(" \u3001 ")}
2
- `,""))!=null?l:"",s.setAttribute("id","tagToolTag"),o==null||o.appendChild(s),s}static drawLineWithPointList(r,t,l={}){if(t.length<2)return;const o=r.getContext("2d"),{color:e=w,thickness:s=1,lineCap:n="round",lineType:c=x.Line,lineDash:a,hoverEdgeIndex:i}=l;o.save(),(()=>{o.strokeStyle=e,o.lineWidth=s,o.lineCap=n,Array.isArray(a)?o.setLineDash(a):o.setLineDash([])})(),c===x.Curve?(i!==void 0&&i>-1&&t.push(t[0]),t=m.createSmoothCurvePointsFromPointList([...t],P),i!==void 0&&i>-1&&(t=t.slice((P+1)*i,(P+1)*(i+1)))):i!==void 0&&i>-1&&(t=[...t,t[0]],t=t.slice(i,i+2));const d=[];o.beginPath(),o.moveTo(t[0].x,t[0].y);for(let h=0;h<t.length-1;h++)t[h].specialEdge&&d.push({i1:h,i2:h+1}),o.lineTo(t[h+1].x,t[h+1].y);o.stroke(),o.save(),o.lineWidth=s*.8,o.lineCap="butt",o.strokeStyle="white",o.setLineDash([3,3]),d.forEach(h=>{const C=t[h.i1],p=t[h.i2];o.beginPath(),o.moveTo(C.x,C.y),o.lineTo(p.x,p.y),o.stroke()}),o.restore();const g=4,u=2;return t.forEach(h=>{h.specialPoint&&(this.drawSpecialPoint(r,h,g+u,e),this.drawSpecialPoint(r,h,g,"white"))}),o.restore(),t}static drawCircle(r,t,l,o={}){const e=r.getContext("2d"),{startAngleDeg:s=0,endAngleDeg:n=360,thickness:c=1,color:a=w,fill:i=w}=o,f=T.deg2rad(s),d=T.deg2rad(n);e.save(),e.beginPath(),e.strokeStyle=a,e.fillStyle=i,e.lineWidth=c,e.arc(t.x,t.y,l,f,d,!1),e.stroke(),i&&e.fill(),e.closePath(),e.restore()}static drawCircleWithFill(r,t,l=3,o={}){const e=r.getContext("2d"),{color:s=w}=o;e.save();const n=T.deg2rad(0),c=T.deg2rad(360);e.fillStyle=s,e.beginPath(),e.arc(t.x,t.y,l,n,c,!1),e.fill(),e.restore()}static drawSpecialPoint(r,t,l=6,o){const e=r.getContext("2d"),{x:s,y:n}=t;e.save(),e.beginPath(),e.fillStyle=o;const c=l*1.5,a=c*Math.sqrt(3)/2,i=c/2;e.moveTo(s,n-c),e.lineTo(s-a,n+i),e.lineTo(s+a,n+i),e.closePath(),e.fill(),e.restore()}static drawPolygon(r,t,l={}){const{isClose:o=!1,lineType:e=x.Line}=l;return o===!0&&(t=[...t,t[0]]),e===x.Curve&&(t=m.createSmoothCurvePointsFromPointList([...t])),this.drawLineWithPointList(r,t,W(F({},l),{lineType:x.Line})),t}static drawPolygonWithFill(r,t,l={}){if(t.length<2)return;const o=r.getContext("2d"),{color:e=w,lineType:s=x.Line}=l;o.save(),o.fillStyle=e,o.beginPath(),s===x.Curve&&(t=m.createSmoothCurvePointsFromPointList([...t,t[0]]));const[n,...c]=t;return o.moveTo(n.x,n.y),c.forEach(a=>{o.lineTo(a.x,a.y)}),o.fill(),o.restore(),t}static drawPolygonWithFillAndLine(r,t,l={}){const{strokeColor:o,fillColor:e,thickness:s,lineCap:n,isClose:c,lineType:a}=l,i=this.drawPolygon(r,t,{color:o,thickness:s,lineCap:n,isClose:c,lineType:a});return this.drawPolygonWithFill(r,t,{color:e,lineType:a}),i}static drawPolygonWithKeyPoint(r,t,l={}){const{pointColor:o="white",strokeColor:e}=l,s=this.drawPolygon(r,t,l);return s.forEach(n=>{this.drawCircleWithFill(r,n,4,{color:e}),this.drawCircleWithFill(r,n,3,{color:o})}),s}static drawSelectedPolygonWithFillAndLine(r,t,l={}){const{pointColor:o="white",strokeColor:e}=l,s=this.drawPolygonWithFillAndLine(r,t,l);return s.forEach(n=>{this.drawCircleWithFill(r,n,4,{color:e}),this.drawCircleWithFill(r,n,3,{color:o})}),s}static drawText(r,t,l,o={}){if(!l)return;const e=r.getContext("2d"),{color:s=w,font:n=S,shadowColor:c="",shadowBlur:a=0,shadowOffsetX:i=0,shadowOffsetY:f=0,textMaxWidth:d=164,offsetX:g=0,offsetY:u=0,textAlign:h="start",lineHeight:C}=o;e.save(),e.textAlign=h,e.fillStyle=s!=null?s:"white",e.font=n,e.shadowColor=c,e.shadowOffsetX=i,e.shadowOffsetY=f,e.shadowBlur=a,this.wrapText(r,`${l}`,t.x+g,t.y+u,d,C),e.restore()}static wrapText(r,t,l,o,e,s){if(typeof t!="string"||typeof l!="number"||typeof o!="number")return;const n=r.getContext("2d");typeof e=="undefined"&&(e=r&&r.width||300),typeof s=="undefined"&&(s=r&&parseInt(window.getComputedStyle(r).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const c=t.split(`
3
- `);for(let a=0;a<c.length;a++){const i=c[a].split("");let f="";for(let d=0;d<i.length;d++){const g=f+i[d],h=n.measureText(g).width;e||(e=300),h>e&&d>0?(n.fillText(f,l,o),f=i[d],o+=s):f=g}n.fillText(f,l,o),o+=s}}static drawArrow(r,t,l,o={}){const{color:e=w,thickness:s=1,lineCap:n="round",theta:c=30,headLen:a=10}=o,i=Math.atan2(t.y-l.y,t.x-l.x)*180/Math.PI,f=(i+c)*Math.PI/180,d=(i-c)*Math.PI/180,g=a*Math.cos(f),u=a*Math.sin(f),h=a*Math.cos(d),C=a*Math.sin(d);r.save(),r.strokeStyle=e,r.lineWidth=s,r.lineCap=n,r.beginPath(),r.moveTo(l.x+g,l.y+u),r.lineTo(l.x,l.y),r.lineTo(l.x+h,l.y+C),r.stroke(),r.restore()}static drawArrowByCanvas(r,t,l,o={}){const e=r.getContext("2d");this.drawArrow(e,t,l,o)}}b.drawImg=(y,r,t={})=>{const l=y.getContext("2d"),{zoom:o=M,currentPos:e=I,rotate:s=R,imgAttribute:n}=t;switch(l.save(),s){case 0:l.translate(e.x,e.y);break;case 90:l.translate(e.x+r.height*o,e.y),l.rotate(90*Math.PI/180);break;case 180:l.translate(e.x+r.width*o,e.y+r.height*o),l.rotate(Math.PI);break;case 270:l.translate(e.x,e.y+r.width*o),l.rotate(270*Math.PI/180);break;default:l.translate(e.x,e.y);break}if(n){const{contrast:c,saturation:a,brightness:i}=n;l.filter=`saturate(${a+100}%) contrast(${c+100}%) brightness(${i+100}%)`}l.drawImage(r,0,0,r.width*o,r.height*o),l.restore()};export{b as default};
1
+ import{ELineTypes as u,SEGMENT_NUMBER as m,DEFAULT_FONT as E}from"../../constant/tool.js";import p from"./PolygonUtils.js";import C from"./UnitUtils.js";import S from"./AxisUtils.js";import{getCuboidAllSideLine as D,getPointListsByDirection as O}from"./CuboidUtils.js";var F=Object.defineProperty,W=Object.defineProperties,U=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,_=(r,t,i)=>t in r?F(r,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[t]=i,T=(r,t)=>{for(var i in t||(t={}))M.call(t,i)&&_(r,i,t[i]);if(v)for(var i of v(t))I.call(t,i)&&_(r,i,t[i]);return r},b=(r,t)=>W(r,U(t));const R=1,L={x:0,y:0},$=0,g="",P=class{static drawLine(r,t,i,e={}){const o=r.getContext("2d"),{color:l=g,thickness:s=1,lineCap:c="round",lineDash:a}=e;o.save(),o.strokeStyle=l,o.lineWidth=s,o.lineCap=c,a&&o.setLineDash(a),o.beginPath(),o.moveTo(t.x,t.y),o.lineTo(i.x+1,i.y+1),o.stroke(),o.restore()}static drawRect(r,t,i={}){const e=r.getContext("2d"),{color:o=g,thickness:l=1,lineCap:s="round",hiddenText:c=!1,lineDash:a}=i;if(e.save(),e.strokeStyle=o,e.lineWidth=l,e.lineCap=s,Array.isArray(a)&&e.setLineDash(a),e.fillStyle=o,e.strokeRect(t.x,t.y,t.width,t.height),c===!1){let n="";if(t.attribute&&(n=`${n} ${t.attribute}`),this.drawText(r,{x:t.x,y:t.y-5},n),t.textAttribute){const d=`${~~t.width} * ${~~t.height}`.length*7,y=0,w=Math.max(20,t.width-d);this.drawText(r,{x:t.x,y:t.y+t.height+20+y},t.textAttribute,{textMaxWidth:w})}}e.restore()}static drawRectWithFill(r,t,i={}){const e=r.getContext("2d"),{color:o=g}=i;e.save(),e.fillStyle=o,e.fillRect(t.x,t.y,t.width,t.height),e.restore()}static drawTagByDom(r,t,i){const e=r;if(!((t==null?void 0:t.length)>0))return;const o=document.createElement("div");return o.innerHTML=t,o.setAttribute("id",i),e==null||e.appendChild(o),o}static drawTag(r,t){var i;const e=r==null?void 0:r.parentNode,o=window.self.document.getElementById("tagToolTag");if(o&&e&&e.contains(o)&&(e==null||e.removeChild(o)),!((t==null?void 0:t.length)>0))return;const l=document.createElement("div");return l.innerHTML=(i=t.reduce((s,c)=>`${s}${c.keyName}: ${c.value.join(" \u3001 ")}
2
+ `,""))!=null?i:"",l.setAttribute("id","tagToolTag"),e==null||e.appendChild(l),l}static drawLineWithPointList(r,t,i={}){if(t.length<2)return;const e=r.getContext("2d"),{color:o=g,thickness:l=1,lineCap:s="round",lineType:c=u.Line,lineDash:a,hoverEdgeIndex:n}=i;e.save(),(()=>{e.strokeStyle=o,e.lineWidth=l,e.lineCap=s,Array.isArray(a)?e.setLineDash(a):e.setLineDash([])})(),c===u.Curve?(n!==void 0&&n>-1&&t.push(t[0]),t=p.createSmoothCurvePointsFromPointList([...t],m),n!==void 0&&n>-1&&(t=t.slice((m+1)*n,(m+1)*(n+1)))):n!==void 0&&n>-1&&(t=[...t,t[0]],t=t.slice(n,n+2));const d=[];e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let h=0;h<t.length-1;h++)t[h].specialEdge&&d.push({i1:h,i2:h+1}),e.lineTo(t[h+1].x,t[h+1].y);e.stroke(),e.save(),e.lineWidth=l*.8,e.lineCap="butt",e.strokeStyle="white",e.setLineDash([3,3]),d.forEach(h=>{const x=t[h.i1],A=t[h.i2];e.beginPath(),e.moveTo(x.x,x.y),e.lineTo(A.x,A.y),e.stroke()}),e.restore();const y=4,w=2;return t.forEach(h=>{h.specialPoint&&(this.drawSpecialPoint(r,h,y+w,o),this.drawSpecialPoint(r,h,y,"white"))}),e.restore(),t}static drawCircle(r,t,i,e={}){const o=r.getContext("2d"),{startAngleDeg:l=0,endAngleDeg:s=360,thickness:c=1,color:a=g,fill:n=g}=e,f=C.deg2rad(l),d=C.deg2rad(s);o.save(),o.beginPath(),o.strokeStyle=a,o.fillStyle=n,o.lineWidth=c,o.arc(t.x,t.y,i,f,d,!1),o.stroke(),n&&o.fill(),o.closePath(),o.restore()}static drawCircleWithFill(r,t,i=3,e={}){const o=r.getContext("2d"),{color:l=g}=e;o.save();const s=C.deg2rad(0),c=C.deg2rad(360);o.fillStyle=l,o.beginPath(),o.arc(t.x,t.y,i,s,c,!1),o.fill(),o.restore()}static drawSpecialPoint(r,t,i=6,e){const o=r.getContext("2d"),{x:l,y:s}=t;o.save(),o.beginPath(),o.fillStyle=e;const c=i*1.5,a=c*Math.sqrt(3)/2,n=c/2;o.moveTo(l,s-c),o.lineTo(l-a,s+n),o.lineTo(l+a,s+n),o.closePath(),o.fill(),o.restore()}static drawPolygon(r,t,i={}){const{isClose:e=!1,lineType:o=u.Line}=i;return e===!0&&(t=[...t,t[0]]),o===u.Curve&&(t=p.createSmoothCurvePointsFromPointList([...t])),this.drawLineWithPointList(r,t,b(T({},i),{lineType:u.Line})),t}static drawPolygonWithFill(r,t,i={}){if(t.length<2)return;const e=r.getContext("2d"),{color:o=g,lineType:l=u.Line}=i;e.save(),e.fillStyle=o,e.beginPath(),l===u.Curve&&(t=p.createSmoothCurvePointsFromPointList([...t,t[0]]));const[s,...c]=t;return e.moveTo(s.x,s.y),c.forEach(a=>{e.lineTo(a.x,a.y)}),e.fill(),e.restore(),t}static drawPolygonWithFillAndLine(r,t,i={}){const{strokeColor:e,fillColor:o,thickness:l,lineCap:s,isClose:c,lineType:a}=i,n=this.drawPolygon(r,t,{color:e,thickness:l,lineCap:s,isClose:c,lineType:a});return this.drawPolygonWithFill(r,t,{color:o,lineType:a}),n}static drawPolygonWithKeyPoint(r,t,i={}){const{pointColor:e="white",strokeColor:o}=i,l=this.drawPolygon(r,t,i);return l.forEach(s=>{this.drawCircleWithFill(r,s,4,{color:o}),this.drawCircleWithFill(r,s,3,{color:e})}),l}static drawSelectedPolygonWithFillAndLine(r,t,i={}){const{pointColor:e="white",strokeColor:o}=i,l=this.drawPolygonWithFillAndLine(r,t,i);return l.forEach(s=>{this.drawCircleWithFill(r,s,4,{color:o}),this.drawCircleWithFill(r,s,3,{color:e})}),l}static drawText(r,t,i,e={}){if(!i)return;const o=r.getContext("2d"),{color:l=g,font:s=E,shadowColor:c="",shadowBlur:a=0,shadowOffsetX:n=0,shadowOffsetY:f=0,textMaxWidth:d=164,offsetX:y=0,offsetY:w=0,textAlign:h="start",lineHeight:x}=e;o.save(),o.textAlign=h,o.fillStyle=l!=null?l:"white",o.font=s,o.shadowColor=c,o.shadowOffsetX=n,o.shadowOffsetY=f,o.shadowBlur=a,this.wrapText(r,`${i}`,t.x+y,t.y+w,d,x),o.restore()}static wrapText(r,t,i,e,o,l){if(typeof t!="string"||typeof i!="number"||typeof e!="number")return;const s=r.getContext("2d");typeof o=="undefined"&&(o=r&&r.width||300),typeof l=="undefined"&&(l=r&&parseInt(window.getComputedStyle(r).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const c=t.split(`
3
+ `);for(let a=0;a<c.length;a++){const n=c[a].split("");let f="";for(let d=0;d<n.length;d++){const y=f+n[d],h=s.measureText(y).width;o||(o=300),h>o&&d>0?(s.fillText(f,i,e),f=n[d],e+=l):f=y}s.fillText(f,i,e),e+=l}}static drawArrow(r,t,i,e={}){const{color:o=g,thickness:l=1,lineCap:s="round",theta:c=30,headLen:a=10}=e,n=Math.atan2(t.y-i.y,t.x-i.x)*180/Math.PI,f=(n+c)*Math.PI/180,d=(n-c)*Math.PI/180,y=a*Math.cos(f),w=a*Math.sin(f),h=a*Math.cos(d),x=a*Math.sin(d);r.save(),r.strokeStyle=o,r.lineWidth=l,r.lineCap=s,r.beginPath(),r.moveTo(i.x+y,i.y+w),r.lineTo(i.x,i.y),r.lineTo(i.x+h,i.y+x),r.stroke(),r.restore()}static drawArrowByCanvas(r,t,i,e={}){const o=r.getContext("2d");this.drawArrow(o,t,i,e)}static drawCuboid(r,t,i={}){const{backPoints:e,direction:o,frontPoints:l}=t,{strokeColor:s,thickness:c,fillColor:a}=i,n={color:s,thickness:c};if(e){const d=S.transformPlain2PointList(e);P.drawPolygon(r,d,b(T({},n),{isClose:!0}));const y=D(t);y==null||y.forEach(w=>{P.drawLine(r,w.p1,w.p2,T({},n))})}const f=S.transformPlain2PointList(l);if(o&&e&&l){const d=O({direction:o,frontPoints:l,backPoints:e});d&&P.drawPolygonWithFill(r,d,{color:a})}P.drawPolygon(r,f,b(T({},n),{isClose:!0}))}};let k=P;k.drawImg=(r,t,i={})=>{const e=r.getContext("2d"),{zoom:o=R,currentPos:l=L,rotate:s=$,imgAttribute:c}=i;switch(e.save(),s){case 0:e.translate(l.x,l.y);break;case 90:e.translate(l.x+t.height*o,l.y),e.rotate(90*Math.PI/180);break;case 180:e.translate(l.x+t.width*o,l.y+t.height*o),e.rotate(Math.PI);break;case 270:e.translate(l.x,l.y+t.width*o),e.rotate(270*Math.PI/180);break;default:e.translate(l.x,l.y);break}if(c){const{contrast:a,saturation:n,brightness:f}=c;e.filter=`saturate(${n+100}%) contrast(${a+100}%) brightness(${f+100}%)`}e.drawImage(t,0,0,t.width*o,t.height*o),e.restore()};export{k as default};
@@ -1 +1 @@
1
- import{EToolName as o,ECheckModel as n}from"../../constant/tool.js";import i from"../../core/toolOperation/ScribbleTool.js";import a from"../../core/toolOperation/checkOperation.js";import c from"../../core/toolOperation/polygonOperation.js";import{RectOperation as p}from"../../core/toolOperation/rectOperation.js";import l from"../../core/toolOperation/tagOperation.js";import m from"../../core/toolOperation/LineToolOperation.js";import s from"../../core/toolOperation/pointOperation.js";import O from"../../core/toolOperation/TextToolOperation.js";import T from"../../core/toolOperation/segmentByRect.js";import f from"./CommonToolUtils.js";const t=e=>{switch(e){case o.Rect:case o.RectTrack:return p;case o.SegmentByRect:return T;case o.Tag:return l;case o.Polygon:return c;case n.Check:return a;case o.Line:return m;case o.Point:return s;case o.Text:return O;case o.ScribbleTool:return i;default:throw new Error("not match tool")}};class r extends f{}r.getCurrentOperation=t;export{r as default,t as getCurrentOperation};
1
+ import{EToolName as o,ECheckModel as n}from"../../constant/tool.js";import i from"../../core/toolOperation/ScribbleTool.js";import a from"../../core/toolOperation/cuboidOperation.js";import p from"../../core/toolOperation/pointCloud2dOperation.js";import c from"../../core/toolOperation/checkOperation.js";import l from"../../core/toolOperation/polygonOperation.js";import{RectOperation as m}from"../../core/toolOperation/rectOperation.js";import s from"../../core/toolOperation/tagOperation.js";import O from"../../core/toolOperation/LineToolOperation.js";import u from"../../core/toolOperation/pointOperation.js";import T from"../../core/toolOperation/TextToolOperation.js";import f from"../../core/toolOperation/segmentByRect.js";import j from"./CommonToolUtils.js";const e=t=>{switch(t){case o.Rect:case o.RectTrack:return m;case o.SegmentByRect:return f;case o.Tag:return s;case o.Polygon:return l;case n.Check:return c;case o.Line:return O;case o.Point:return u;case o.Text:return T;case o.ScribbleTool:return i;case o.Cuboid:return a;case o.PointCloudPolygon:return p;default:throw new Error("not match tool")}};class r extends j{}r.getCurrentOperation=e;export{r as default,e as getCurrentOperation};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-annotation",
3
- "version": "1.13.0-alpha.7",
3
+ "version": "1.14.0-alpha.0",
4
4
  "description": "Annotation tool collection",
5
5
  "keywords": [
6
6
  "annotation",
@@ -92,11 +92,11 @@
92
92
  "typescript": "^4.2.3"
93
93
  },
94
94
  "dependencies": {
95
- "@labelbee/lb-utils": "^1.6.0-alpha.5",
95
+ "@labelbee/lb-utils": "^1.7.0-alpha.0",
96
96
  "@turf/turf": "5.1.6",
97
97
  "color-rgba": "^2.3.0",
98
98
  "lodash": "^4.17.20",
99
99
  "three": ">=0.141.0"
100
100
  },
101
- "gitHead": "95a39c945895bb420d8ab7485e7a49176dae2a76"
101
+ "gitHead": "86c10122b654945d5bcb0d6208551d4996a276f1"
102
102
  }