From 2611df4898dcbbfeeee5b8912a124c0d7714aacc Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Tue, 26 Mar 2024 01:03:05 +0800 Subject: [PATCH] v11.points = obj.obj.points MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 改为 if( obj.hasOwnProperty("points")) { v11.points = obj.points } 该属性不一定存在 --- altium_sch.html | 1 - altium_sch_renderer.js | 35 +++++++---------------------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/altium_sch.html b/altium_sch.html index 8a12e28..742c06a 100644 --- a/altium_sch.html +++ b/altium_sch.html @@ -154,7 +154,6 @@ function renderSchematic(data) renderer.render(); } - o instanceof AltiumWire)) - // { - // // for (let i = 1; i < obj.points.length; i++) - // // { - // // obj.points[i].y = 840 - obj.points[i].y - // // } - // var obj1 = this.graph.getCellAt(obj.points[0].x,obj.points[0].y,parent) - // var obj2 = this.graph.getCellAt(obj.points[obj.points.length - 1].x, - // obj.points[obj.points.length - 1].y,parent) - - // mxLog.debug(obj1,obj2) - // // if (!this.#shouldShow(obj)) continue; - - // // ctx.strokeStyle = this.#altiumColourToHex(obj.colour); - // // ctx.lineWidth = obj.width; - // // ctx.beginPath(); - // // ctx.moveTo(obj.points[0].x, obj.points[0].y); - // // for (let i = 1; i < obj.points.length; i++) - // // { - // // ctx.lineTo(obj.points[i].x, obj.points[i].y); - // // } - // // ctx.stroke(); - // } + for (let obj of doc.objects.filter((o) => o instanceof AltiumBus)) { // if (!this.#shouldShow(obj)) continue; @@ -984,8 +963,9 @@ class AltiumSchematicRenderer // mxLog.debug(style) var v11 = this.graph.insertVertex(parent, null, '', obj.points[0], obj.points[0], 1,1,style); - - v11.points = obj.obj.points + if( obj.hasOwnProperty("points")) { + v11.points = obj.points + } v11.geometry.relative = false; if(chips[obj.owner_record_index] == undefined){ chips[obj.owner_record_index] = [] @@ -1341,7 +1321,6 @@ class AltiumSchematicRenderer e6.geometry.setTerminalPoint(new mxPoint(obj.points[obj.points.length - 1].x, obj.points[obj.points.length - 1].y), false) - if(this.wires == undefined){ this.wires = [] this.wires.push(e6)