Compare commits
No commits in common. "4d4ac37e73e4f2628bec205db3a9797306f79c71" and "aec7de62d48ba33b845b5eb6edcda6d34c87f1ff" have entirely different histories.
4d4ac37e73
...
aec7de62d4
|
@ -63,12 +63,12 @@ class AltiumSchematicRenderer
|
|||
render() {
|
||||
let oldMove = mxGraphHandler.prototype.mouseMove
|
||||
mxGraphHandler.prototype.mouseMove = function(sender, me){
|
||||
// console.log("mouse move",sender,me)
|
||||
console.log("mouse move",sender,me)
|
||||
// https://github.com/jgraph/mxgraph/blob/master/javascript/src/js/handler/mxGraphHandler.js#L901
|
||||
if (!this.livePreviewUsed && this.shape == null) {
|
||||
this.shape = this.createPreviewShape(this.bounds);
|
||||
}else if(this.shape != null){
|
||||
// console.log("mouseMove",this)
|
||||
console.log("mouseMove",this)
|
||||
}
|
||||
oldMove.call(this, sender, me);
|
||||
}
|
||||
|
@ -103,9 +103,6 @@ class AltiumSchematicRenderer
|
|||
};
|
||||
|
||||
this.graph = new mxGraph(document.getElementById('graphContainer'));
|
||||
|
||||
|
||||
|
||||
this.graph.setPanning(true);
|
||||
this.graph.setConnectable(true);
|
||||
this.graph.setConnectableEdges(true);
|
||||
|
@ -211,8 +208,6 @@ class AltiumSchematicRenderer
|
|||
style['movable'] = '0';
|
||||
style['strokeWidth'] = strokeWidth;
|
||||
style['rounded'] = '0';
|
||||
style[mxConstants.STYLE_FONTSIZE] = '11';
|
||||
|
||||
|
||||
// Sets join node size
|
||||
style['startSize'] = joinNodeSize;
|
||||
|
@ -225,7 +220,7 @@ class AltiumSchematicRenderer
|
|||
style['fillColor'] = 'none';
|
||||
style['fontColor'] = fontColor;
|
||||
style['fontStyle'] = '1';
|
||||
style['fontSize'] = '6';
|
||||
style['fontSize'] = '12';
|
||||
style['resizable'] = '0';
|
||||
style['strokeWidth'] = strokeWidth;
|
||||
// let canvas = this.canvas;
|
||||
|
@ -449,7 +444,6 @@ class AltiumSchematicRenderer
|
|||
|
||||
for (let obj of doc.objects.filter((o) => o instanceof AltiumTextFrame))
|
||||
{
|
||||
obj = obj
|
||||
// if (!this.#shouldShow(obj)) continue;
|
||||
|
||||
// if (!obj.transparent)
|
||||
|
@ -468,8 +462,6 @@ class AltiumSchematicRenderer
|
|||
|
||||
for (let obj of doc.objects.filter((o) => o instanceof AltiumEllipse))
|
||||
{
|
||||
obj = obj
|
||||
|
||||
// if (!this.#shouldShow(obj)) continue;
|
||||
|
||||
// if (!obj.transparent)
|
||||
|
@ -486,20 +478,12 @@ class AltiumSchematicRenderer
|
|||
for (let obj of doc.objects.filter((o) => o instanceof AltiumPin))
|
||||
{
|
||||
var style = 'shape=line;fontColor=#000000;strokeColor=#000000;'
|
||||
let name = ''
|
||||
if(obj.show_name){
|
||||
name = obj.name
|
||||
}
|
||||
if(obj.angle == 0){
|
||||
style = style + 'labelPosition=left;'
|
||||
}
|
||||
if(obj.angle == 90){
|
||||
style += 'rotation=90'
|
||||
obj.y = obj.y + obj.length/2
|
||||
obj.x = obj.x - obj.length/2
|
||||
}
|
||||
if(obj.angle == 180){
|
||||
style = style + 'labelPosition=right;'
|
||||
obj.x = obj.x - obj.length
|
||||
}
|
||||
if(obj.angle == 270){
|
||||
|
@ -510,7 +494,7 @@ class AltiumSchematicRenderer
|
|||
obj.y = 840 - obj.y
|
||||
|
||||
// console.log(style)
|
||||
var v11 = this.graph.insertVertex(parent, null, name, obj.x, obj.y,
|
||||
var v11 = this.graph.insertVertex(parent, null, '', obj.x, obj.y,
|
||||
obj.length, 1,
|
||||
style);
|
||||
v11.geometry.relative = false;
|
||||
|
@ -578,8 +562,6 @@ class AltiumSchematicRenderer
|
|||
|
||||
for (let obj of doc.objects.filter((o) => o instanceof AltiumArc))
|
||||
{
|
||||
obj = obj
|
||||
|
||||
// if (!this.#shouldShow(obj)) continue;
|
||||
|
||||
// ctx.strokeStyle = this.#altiumColourToHex(obj.colour);
|
||||
|
@ -593,26 +575,7 @@ class AltiumSchematicRenderer
|
|||
|
||||
for (let obj of doc.objects.filter((o) => o instanceof AltiumPolygon))
|
||||
{
|
||||
obj = obj
|
||||
mxCellRenderer.registerShape('polygon', mxPolygon);
|
||||
obj.x2 = 840 - obj.x2
|
||||
obj.y2 = 840 - obj.y2
|
||||
style = 'shape=polygon;strokeColor=#0000ff;'
|
||||
// console.log(style)
|
||||
var v11 = this.graph.insertVertex(parent, null, '', obj.points[0], obj.points[0],
|
||||
1,1,style);
|
||||
|
||||
v11.points = obj.obj.points
|
||||
v11.geometry.relative = false;
|
||||
if(chips[obj.owner_record_index] == undefined){
|
||||
chips[obj.owner_record_index] = []
|
||||
}
|
||||
if(chips[obj.owner_record_index] == undefined){
|
||||
chips[obj.owner_record_index] = []
|
||||
}
|
||||
v11.setConnectable(false);
|
||||
|
||||
chips[obj.owner_record_index].push(v11)
|
||||
// if (!this.#shouldShow(obj)) continue;
|
||||
|
||||
// ctx.strokeStyle = this.#altiumColourToHex(obj.line_colour);
|
||||
|
@ -632,7 +595,6 @@ class AltiumSchematicRenderer
|
|||
|
||||
for (let obj of doc.objects.filter((o) => o instanceof AltiumJunction))
|
||||
{
|
||||
obj = obj
|
||||
|
||||
// if (!this.#shouldShow(obj)) continue;
|
||||
|
||||
|
@ -739,17 +701,13 @@ class AltiumSchematicRenderer
|
|||
for (let obj of doc.objects.filter((o) => o instanceof AltiumLabel))
|
||||
{
|
||||
obj.y = 840 - obj.y
|
||||
if(obj.text != undefined){
|
||||
console.log(obj.text.length)
|
||||
var v11 = this.graph.insertVertex(parent, null, obj.text, obj.x, obj.y - 4,
|
||||
obj.text.length*9/2, 0,
|
||||
"shape=label;fontSize=9;");
|
||||
var v11 = this.graph.insertVertex(parent, null, obj.text, obj.x, obj.y,
|
||||
0, 0,
|
||||
"shape=label");
|
||||
v11.geometry.relative = false;
|
||||
v11.setConnectable(false);
|
||||
if(obj.owner_record_index != 1)
|
||||
chips[obj.owner_record_index].push(v11)
|
||||
}
|
||||
|
||||
|
||||
// if (!this.#shouldShow(obj)) continue;
|
||||
|
||||
|
@ -769,18 +727,6 @@ class AltiumSchematicRenderer
|
|||
|
||||
for (let obj of doc.objects.filter((o) => o instanceof AltiumDesignator))
|
||||
{
|
||||
obj = obj
|
||||
obj.y = 840 - obj.y
|
||||
if(obj.text != undefined){
|
||||
console.log(obj.text.length)
|
||||
var v11 = this.graph.insertVertex(parent, null, obj.text, obj.x, obj.y - 4,
|
||||
obj.text.length*9/2, 0,
|
||||
"shape=label;fontSize=9;");
|
||||
v11.geometry.relative = false;
|
||||
v11.setConnectable(false);
|
||||
if(obj.owner_record_index != 1)
|
||||
chips[obj.owner_record_index].push(v11)
|
||||
}
|
||||
// if (!this.#shouldShow(obj)) continue;
|
||||
|
||||
// if (obj.hidden)
|
||||
|
@ -973,6 +919,7 @@ class AltiumSchematicRenderer
|
|||
e6.geometry.points = poi
|
||||
|
||||
e6.geometry.setTerminalPoint(new mxPoint(obj.points[0].x, obj.points[0].y), true)
|
||||
|
||||
e6.geometry.setTerminalPoint(new mxPoint(obj.points[obj.points.length - 1].x,
|
||||
obj.points[obj.points.length - 1].y), false)
|
||||
|
||||
|
|
|
@ -693,8 +693,6 @@ if (mxForceIncludes || !(typeof module === 'object' && module.exports != null))
|
|||
mxClient.include(mxClient.basePath+'/js/shape/mxStencilRegistry.js');
|
||||
mxClient.include(mxClient.basePath+'/js/shape/mxMarker.js');
|
||||
mxClient.include(mxClient.basePath+'/js/shape/mxActor.js');
|
||||
mxClient.include(mxClient.basePath+'/js/shape/mxPolygon.js');
|
||||
|
||||
mxClient.include(mxClient.basePath+'/js/shape/mxCloud.js');
|
||||
mxClient.include(mxClient.basePath+'/js/shape/mxRectangleShape.js');
|
||||
mxClient.include(mxClient.basePath+'/js/shape/mxEllipse.js');
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2006-2015, JGraph Ltd
|
||||
* Copyright (c) 2006-2015, Gaudenz Alder
|
||||
*/
|
||||
/**
|
||||
* Class: mxTriangle
|
||||
*
|
||||
* Implementation of the triangle shape.
|
||||
*
|
||||
* Constructor: mxTriangle
|
||||
*
|
||||
* Constructs a new triangle shape.
|
||||
*/
|
||||
function mxPolygon()
|
||||
{
|
||||
mxActor.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Extends mxActor.
|
||||
*/
|
||||
mxUtils.extend(mxPolygon, mxActor);
|
||||
|
||||
/**
|
||||
* Function: isRoundable
|
||||
*
|
||||
* Adds roundable support.
|
||||
*/
|
||||
mxPolygon.prototype.isRoundable = function()
|
||||
{
|
||||
return true;
|
||||
};
|
||||
|
||||
// /**
|
||||
// * Function: redrawPath
|
||||
// *
|
||||
// * Draws the path for this shape.
|
||||
// */
|
||||
// mxPolygon.prototype.redrawPath = function(c, x, y, w, h)
|
||||
// {
|
||||
// var arcSize = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2;
|
||||
// this.addPoints(c, [new mxPoint(0, 0), new mxPoint(w, 0.5 * h), new mxPoint(0, h)], this.isRounded, 23, true);
|
||||
// };
|
||||
|
||||
mxPolygon.prototype.paintVertexShape = function(c, x, y, w, h)
|
||||
{
|
||||
console.log(this.state.cell)
|
||||
let poi = this.state.cell.points
|
||||
c.begin();
|
||||
c.moveTo(x,y);
|
||||
for(let i = 0;i < poi.length;i++){
|
||||
c.lineTo(poi[i].x,poi[i].y);
|
||||
}
|
||||
c.lineTo(x,y);
|
||||
c.close()
|
||||
c.fillAndStroke();
|
||||
};
|
Loading…
Reference in New Issue