ananzhusen há 2 anos atrás
pai
commit
2af56200ec

+ 5 - 0
index.html

@@ -33,5 +33,10 @@
         return this.replace(new RegExp(s1, 'gm'), s2);
       };
     </script>
+        <script defer src="/js/html2canvas.min.js"></script>
+        <script defer src="/js/flv.min.js"></script>
+        <script defer src="/js/marked.min.js"></script>
+        <script defer src="/js/echarts.min.js"></script>
+        <script defer src="/js/mycharts.js"></script>
   </body>
 </html>

Diff do ficheiro suprimidas por serem muito extensas
+ 34 - 0
public/js/echarts.min.js


Diff do ficheiro suprimidas por serem muito extensas
+ 8 - 0
public/js/flv.min.js


Diff do ficheiro suprimidas por serem muito extensas
+ 19 - 0
public/js/html2canvas.min.js


Diff do ficheiro suprimidas por serem muito extensas
+ 5 - 0
public/js/marked.min.js


+ 88 - 0
public/js/mycharts.js

@@ -0,0 +1,88 @@
+// 1. 编写图形绘画函数
+// 其中,calculative.worldRect为canvas的世界坐标。更多信息,参考 “架构” - “概要” 和 Pen 相关文档
+// 形参 ctx 仅仅在 downloadSvg 时有值
+function mytriangle(pen, ctx) {
+  const path = !ctx ? new Path2D() : ctx;
+  const { x, y, width, height } = pen.calculative.worldRect;
+  path.moveTo(x + width / 2, y);
+  path.lineTo(x + width, y + height);
+  path.lineTo(x, y + height);
+  path.lineTo(x + width / 2, y);
+
+  path.closePath();
+  if (path instanceof Path2D) return path;
+}
+// 2. 如果需要,编写锚点函数。通常,可以使用默认锚点,然后通过快捷键动态添加锚点
+// 注意,锚点左边为相对宽高的百分比小数(0-1之间的小数)
+function mytriangleAnchors(pen) {
+  const anchors = [];
+  anchors.push({
+    id: '0',
+    penId: pen.id,
+    x: 0.5,
+    y: 0,
+  });
+
+  anchors.push({
+    id: '1',
+    penId: pen.id,
+    x: 1,
+    y: 1,
+  });
+
+  anchors.push({
+    id: '2',
+    penId: pen.id,
+    x: 0,
+    y: 1,
+  });
+  pen.anchors = anchors;
+}
+
+// 需要时打开
+if (false) {
+  window.myCharts = [
+    {
+      name: '我的图形库文件夹名称',
+      list: [
+        {
+          image: '/img/logo.png',
+          name: '自定义图形',
+          penFn: mytriangle,
+          anchorsFn: mytriangleAnchors, // 可以不需要,使用缺省锚点
+          data: {
+            width: 100,
+            height: 100,
+          },
+        },
+      ],
+      show: true,
+    },
+  ];
+}
+
+function beforeSave(data) {
+  // 自己的保存业务逻辑
+  const query = window.location.search.substring(1).split("&");
+  const obj = {};
+  for (let i = 0; i < query.length; i++) {
+    const el = query[i];
+    const kvPairs = el.split("=");
+    obj[kvPairs[0]] = kvPairs[1];
+  }
+  if(obj.eqpickey){
+    if(!data.data){
+      data.data = {};
+    }
+    data.data.eqpickey = obj.eqpickey;
+  }
+  return true;
+}
+
+function afterSave(res){
+  // 保存图纸之后的钩子函数
+  // console.log('afterSave',res)
+}
+
+window.beforeSaveMeta2d = beforeSave;
+window.afterSaveMeta2d = afterSave;

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff