pin和rectangle合并成group

main
zcy 2024-03-03 13:14:38 +08:00
parent 9e95cd3e62
commit 54b7322916
1 changed files with 17 additions and 2 deletions

View File

@ -166,7 +166,7 @@ class AltiumSchematicRenderer
this.graph.gridSize = 1 this.graph.gridSize = 1
//Maximum size //Maximum size
this.graph.maximumGraphBounds = new mxRectangle(0, 0, 1920, 800) this.graph.maximumGraphBounds = new mxRectangle(0, 0, 1920, 800)
this.graph.border = 20; this.graph.border = 0;
var fontColor = '#FFFFFF' ; var fontColor = '#FFFFFF' ;
var strokeColor = '#C0C0C0' ; var strokeColor = '#C0C0C0' ;
var fillColor = '#C0C0C0'; var fillColor = '#C0C0C0';
@ -415,7 +415,7 @@ class AltiumSchematicRenderer
// } // }
// ctx.stroke(); // ctx.stroke();
} }
let chips = {}
var v1 var v1
for (let obj of doc.objects.filter((o) => o instanceof AltiumRectangle)) for (let obj of doc.objects.filter((o) => o instanceof AltiumRectangle))
{ {
@ -431,6 +431,10 @@ class AltiumSchematicRenderer
'verticalLabelPosition=top;verticalAlign=bottom;fillColor=' 'verticalLabelPosition=top;verticalAlign=bottom;fillColor='
+ this.#altiumColourToHex(obj.attributes.areacolor)); + this.#altiumColourToHex(obj.attributes.areacolor));
v1.setConnectable(false); v1.setConnectable(false);
if(chips[obj.owner_record_index] == undefined){
chips[obj.owner_record_index] = []
}
chips[obj.owner_record_index].push(v1)
// if (!this.#shouldShow(obj)) // if (!this.#shouldShow(obj))
// continue; // continue;
@ -522,6 +526,10 @@ class AltiumSchematicRenderer
style); style);
v11.geometry.relative = false; v11.geometry.relative = false;
v11.setConnectable(true); v11.setConnectable(true);
if(chips[obj.owner_record_index] == undefined){
chips[obj.owner_record_index] = []
}
chips[obj.owner_record_index].push(v11)
// v11.geometry.offset = new mxPoint(-v11.geometry.width, 2); // ctx.strokeStyle = "#000000"; // v11.geometry.offset = new mxPoint(-v11.geometry.width, 2); // ctx.strokeStyle = "#000000";
// ctx.beginPath(); // ctx.beginPath();
// ctx.moveTo(obj.x, obj.y); // ctx.moveTo(obj.x, obj.y);
@ -1094,6 +1102,13 @@ class AltiumSchematicRenderer
// } // }
// ctx.stroke(); // ctx.stroke();
} }
for (let i in chips){
let chip = this.graph.groupCells(null,0,chips[i])
chip.setStyle("border = 0")
console.log(chip.getStyle())
console.log(chip.getStyle())
}
} }
finally{ finally{
this.graph.getModel().endUpdate(); this.graph.getModel().endUpdate();