Skip to content

Commit

Permalink
Random Debugging stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlag committed Feb 27, 2014
1 parent 24af7b9 commit 616c341
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
13 changes: 11 additions & 2 deletions obj_path.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
}

Path.prototype.drawPath = function(lctx) {
//if(lctx == _UI.chareditctx) debug("DRAWPATH");

if(this.pathpoints === false || this.pathpoints.length < 2) return;
var pp, np, pph2x, pph2y, nxh1x, nxh1y, nxppx, nxppy;

Expand All @@ -72,6 +74,14 @@
pp = this.pathpoints[cp];
np = this.pathpoints[(cp+1) % this.pathpoints.length];

/*
if(lctx == _UI.chareditctx) {
debug(" point " + cp);
debug("\n pp\n" + JSON.stringify(pp));
debug(" np\n" + JSON.stringify(np));
}
*/

if(pp.type == "symmetric") { pp.makeSymmetric("H1"); }
else if (pp.type == "flat") { pp.makeFlat("H1"); }

Expand All @@ -82,15 +92,14 @@
nxppx = sx_cx(np.P.x);
nxppy = sy_cy(np.P.y);

//if(lctx == _UI.chareditctx) debug(" curve " + pph2x +" "+ pph2y +" "+ nxh1x +" "+ nxh1y +" "+ nxppx +" "+ nxppy);
lctx.bezierCurveTo(pph2x, pph2y, nxh1x, nxh1y, nxppx, nxppy);
}

}

Path.prototype.drawPathToArea = function(lctx, view){
var tempv = clone(getView("Path.drawPathToArea"));
setView(view);

this.drawPath(lctx);

setView(tempv);
Expand Down
23 changes: 22 additions & 1 deletion obj_shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
// -----

Shape.prototype.drawShape_Single = function(lctx){
//debug("DRAWSHAPE_SINGLE");
//this.checkPath();

if(this.visible){
lctx.fillStyle = _GP.projectsettings.color_glyphfill;
if(lctx == _UI.ishereghostctx) { lctx.fillStyle = "rgba(0,0,255,0.2)"; }
Expand All @@ -52,19 +55,21 @@


Shape.prototype.drawShape_Stack = function(lctx){
//debug("DRAWSHAPE_STACK");
if(this.visible){
if(this.link){
_GP.linkedshapes[this.link].shape.drawShape_Stack(lctx);
return;
}

if((this.path.rightx == -1) && (lctx == _UI.chareditctx) && (_UI.selectedtool != "newpath")) this.path.calcMaxes();

this.path.drawPath(lctx);
}
}

Shape.prototype.drawShapeToArea = function(lctx, view){
//debug("DRAWSHAPETOAREA");
if(this.visible){
//debug("drawShapeToArea for shape: " + this.name + " view=" + JSON.stringify(view));
lctx.fillStyle = _GP.projectsettings.color_glyphfill;
Expand All @@ -75,6 +80,22 @@
}
}

Shape.prototype.checkPath = function() {
debug("CHECKPATH - checking " + this.name + "\n" + JSON.stringify(this.path));

for(var pp = 0; pp < this.path.pathpoints.length; pp++){
var tp = this.path.pathpoints[pp];
if(!(tp.P.x)) debug(this.name + " p" + pp + ".P.x is " + tp.P.x);
if(!(tp.P.y)) debug(this.name + " p" + pp + ".P.y is " + tp.P.y);

if(!(tp.H1.x)) debug(this.name + " p" + pp + ".H1.x is " + tp.H1.x);
if(!(tp.H1.y)) debug(this.name + " p" + pp + ".H1.y is " + tp.H1.y);

if(!(tp.H2.x)) debug(this.name + " p" + pp + ".H2.x is " + tp.H2.x);
if(!(tp.H2.y)) debug(this.name + " p" + pp + ".H2.y is " + tp.H2.y);
}
}

//convert stored x-y coord to canvas x-y
function sx_cx(sx){
var v = getView("sx_cx");
Expand Down
7 changes: 6 additions & 1 deletion page_charedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

function drawselectcharthumbs(){
//stack(arguments);
//debug("\n+++++++++++++++++++++\nONE\n+++++++++++++++++++++\n\t"+JSON.stringify(_GP.linkedshapes['id1']));

var ps = _GP.projectsettings;
var factor = ((_UI.thumbsize-(2*_UI.thumbgutter))/(ps.upm));
Expand All @@ -78,6 +79,7 @@

_GP.fontchars[tc].drawCharToArea(sctx, {"dz": factor, "dx" : _UI.thumbgutter, "dy" : yoffset});
}
//debug("\n+++++++++++++++++++++\nTWO\n+++++++++++++++++++++\n\t"+JSON.stringify(_GP.linkedshapes['id1']));
}

function buildbutton(index, fname){
Expand Down Expand Up @@ -215,6 +217,9 @@

//debug("RESETTHUMBVIEW - set to \n" + JSON.stringify(_UI.thumbview));
}



//-------------------
// REDRAW
//-------------------
Expand All @@ -235,8 +240,8 @@

_UI.redrawing = true;


var sc = _GP.fontchars[_UI.selectedchar];

_UI.chareditctx.clearRect(0,0,_UI.chareditcanvassize,_UI.chareditcanvassize);
grid();

Expand Down
4 changes: 3 additions & 1 deletion page_openproject.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
}
}

//debug("HDRYATEGLYPHRPROJECT: JSON \n" + JSON.stringify(data));
//debug("\n\nHDRYATEGLYPHRPROJECT: PASSED \n" + JSON.stringify(data));
//debug("\n\nHDRYATEGLYPHRPROJECT: HYDRATED \n" + JSON.stringify(_GP));

finalizeGlyphrProject();
}

Expand Down

0 comments on commit 616c341

Please sign in to comment.