Skip to content

Commit

Permalink
🐞 fix missing renderer dependencies. metafizzy#10
Browse files Browse the repository at this point in the history
👕 add .jshintrc js/, demos/, tasks
📦 npm ignore dotfiles
  • Loading branch information
desandro committed May 30, 2019
1 parent 3eda40c commit f7b8761
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
File renamed without changes.
5 changes: 5 additions & 0 deletions js/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"browser": true,
"unused": true,
"undef": true
}
13 changes: 8 additions & 5 deletions js/anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
// module definition
if ( typeof module == 'object' && module.exports ) {
/* globals module, require */ // CommonJS
module.exports = factory( require('./boilerplate'), require('./vector') );
module.exports = factory( require('./boilerplate'), require('./vector'),
require('./canvas-renderer'), require('./svg-renderer') );
} else {
// browser global
var Zdog = root.Zdog;
Zdog.Anchor = factory( Zdog, Zdog.Vector );
Zdog.Anchor = factory( Zdog, Zdog.Vector, Zdog.CanvasRenderer,
Zdog.SvgRenderer );
}
}( this, function factory( utils, Vector ) {
}( this, function factory( utils, Vector, CanvasRenderer, SvgRenderer ) {

var TAU = utils.TAU;
var onePoint = { x: 1, y: 1, z: 1 };
Expand Down Expand Up @@ -148,14 +150,15 @@ Anchor.prototype.updateSortValue = function() {

Anchor.prototype.render = function() {};

// TODO refactor out CanvasRenderer so its not a dependency within anchor.js
Anchor.prototype.renderGraphCanvas = function( ctx ) {
if ( !ctx ) {
throw new Error( 'ctx is ' + ctx + '. ' +
'Canvas context required for render. Check .renderGraphCanvas( ctx ).' );
}
this.checkFlatGraph();
this.flatGraph.forEach( function( item ) {
item.render( ctx, Zdog.CanvasRenderer );
item.render( ctx, CanvasRenderer );
});
};

Expand All @@ -166,7 +169,7 @@ Anchor.prototype.renderGraphSvg = function( svg ) {
}
this.checkFlatGraph();
this.flatGraph.forEach( function( item ) {
item.render( svg, Zdog.SvgRenderer );
item.render( svg, SvgRenderer );
});
};

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"description": "Round, flat, designer-friendly pseudo-3D engine",
"main": "js/index.js",
"files": [
"dist/",
"js/"
"dist/*.*",
"js/*.*",
"!js/.*",
"!dist/.*"
],
"dependencies": {},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions tasks/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"esversion": 6,
"node": true,
"unused": true,
"undef": true
}
2 changes: 0 additions & 2 deletions tasks/bundle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* jshint node: true, esversion: 6, unused: true, undef: true */

const fs = require('fs');
const execSync = require('child_process').execSync;

Expand Down
2 changes: 0 additions & 2 deletions tasks/version.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* jshint node: true, esversion: 6, unused: true, undef: true */

const fs = require('fs');
const version = require('../package.json').version;

Expand Down

0 comments on commit f7b8761

Please sign in to comment.