All: added variables for grChipOffsetX/gfChipOffsetY (previously hardcoded to 400/0)

This commit is contained in:
David Banks 2018-09-22 06:49:05 +01:00
parent 225b49a6d8
commit 59792d75fc
5 changed files with 17 additions and 17 deletions

View File

@ -4,7 +4,9 @@
chipname='6800'; chipname='6800';
grChipSize=7000; grChipSize=6600;
grChipOffsetX=25
grChipOffsetY=-200;
ngnd = nodenames['gnd']; ngnd = nodenames['gnd'];
npwr = nodenames['vcc']; npwr = nodenames['vcc'];

View File

@ -5,6 +5,8 @@
chipname='z80'; chipname='z80';
grChipSize=5000; grChipSize=5000;
grChipOffsetX=150;
grChipOffsetY=0;
grCanvasSize=5000; grCanvasSize=5000;
grMaxZoom=24; grMaxZoom=24;
@ -22,15 +24,6 @@ presetLogLists=[
['_int','_nmi', nodenamereset], ['_int','_nmi', nodenamereset],
]; ];
// Override drawSeg so we can use a different offset
function drawSeg(ctx, seg){
var dx = 150;
ctx.beginPath();
ctx.moveTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]));
for(var i=2;i<seg.length;i+=2) ctx.lineTo(grScale(seg[i]+dx), grScale(grChipSize-seg[i+1]));
ctx.lineTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]));
}
function setupTransistors(){ function setupTransistors(){
for(i in transdefs){ for(i in transdefs){
var tdef = transdefs[i]; var tdef = transdefs[i];

View File

@ -43,6 +43,8 @@ var labelThese=[];
// rounding artifacts, and at high zoom there will be anti-aliasing on edges. // rounding artifacts, and at high zoom there will be anti-aliasing on edges.
var grMaxZoom=12; var grMaxZoom=12;
var grChipSize=10000; var grChipSize=10000;
var grChipOffsetX=400;
var grChipOffsetY=0;
var grCanvasSize=2000; var grCanvasSize=2000;
var grLineWidth=1; var grLineWidth=1;
@ -457,7 +459,7 @@ function hiliteNodeList(){
// the localx and localy functions return canvas coordinate offsets from the canvas window top left corner // the localx and localy functions return canvas coordinate offsets from the canvas window top left corner
// we divide the results by 'zoom' to get drawn coordinates useful in findNodeNumber // we divide the results by 'zoom' to get drawn coordinates useful in findNodeNumber
// to convert to reported user chip coordinates we multiply by grChipSize/600 // to convert to reported user chip coordinates we multiply by grChipSize/600
// to compare to segdefs and transdefs coordinates we subtract 400 from x and subtract y from grChipSize // to compare to segdefs and transdefs coordinates we subtract grChipOffsetX from x and subtract y from grChipSize plus grChipOffsetY
function handleClick(e){ function handleClick(e){
var x = localx(hilite, e.clientX)/zoom; var x = localx(hilite, e.clientX)/zoom;
@ -476,8 +478,8 @@ function handleClick(e){
// we have a node, but maybe we clicked over a transistor // we have a node, but maybe we clicked over a transistor
var nodelist=[w]; var nodelist=[w];
// match the coordinate against transistor gate bounding boxes // match the coordinate against transistor gate bounding boxes
x=cx-400; x=cx-grChipOffsetX;
y=grChipSize-cy; y=grChipSize+grChipOffsetY-cy;
for(var i=0;i<nodes[w].gates.length;i++){ for(var i=0;i<nodes[w].gates.length;i++){
var xmin=nodes[w].gates[i].bb[0], xmax=nodes[w].gates[i].bb[1]; var xmin=nodes[w].gates[i].bb[0], xmax=nodes[w].gates[i].bb[1];
var ymin=nodes[w].gates[i].bb[2], ymax=nodes[w].gates[i].bb[3]; var ymin=nodes[w].gates[i].bb[2], ymax=nodes[w].gates[i].bb[3];

View File

@ -45,6 +45,8 @@ var userResetHigh;
// rounding artifacts, and at high zoom there will be anti-aliasing on edges. // rounding artifacts, and at high zoom there will be anti-aliasing on edges.
var grMaxZoom=12; var grMaxZoom=12;
var grChipSize=10000; var grChipSize=10000;
var grChipOffsetX=400;
var grChipOffsetY=0;
var grCanvasSize=2000; var grCanvasSize=2000;
var grLineWidth=1; var grLineWidth=1;

View File

@ -211,11 +211,12 @@ function zoomToBox(xmin,xmax,ymin,ymax){
} }
function drawSeg(ctx, seg){ function drawSeg(ctx, seg){
var dx = 400; var dx = grChipOffsetX;
var dy = grChipOffsetY;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1])); ctx.moveTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]+dy));
for(var i=2;i<seg.length;i+=2) ctx.lineTo(grScale(seg[i]+dx), grScale(grChipSize-seg[i+1])); for(var i=2;i<seg.length;i+=2) ctx.lineTo(grScale(seg[i]+dx), grScale(grChipSize-seg[i+1]+dy));
ctx.lineTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1])); ctx.lineTo(grScale(seg[0]+dx), grScale(grChipSize-seg[1]+dy));
} }
function findNodeNumber(x,y){ function findNodeNumber(x,y){