Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add updatePath() to Cylinder.

Now Cylinders can have their paramters edited live if updatePath()
is called afterwards, bringing it in line with the basic shapes.

Should check out the other composites and see if they need similar
treatment. I think Cone almost certainly does.

Different55 58ae21cd e668d3b3

+11
+11
js/cylinder.js
··· 139 139 // Cylinder shape does not render anything 140 140 Cylinder.prototype.render = function() {}; 141 141 142 + Cylinder.prototype.setPath = function() { 143 + if ( !this.frontBase || !this.rearBase ) return; 144 + var baseZ = this.length / 2; 145 + this.frontBase.translate = { z: baseZ }; 146 + this.frontBase.diameter = this.diameter; 147 + this.rearBase.translate = { z: -baseZ }; 148 + this.rearBase.diameter = this.diameter; 149 + this.frontBase.updatePath(); 150 + this.rearBase.updatePath(); 151 + }; 152 + 142 153 // ----- set child properties ----- // 143 154 144 155 var childProperties = [ 'stroke', 'fill', 'color', 'visible' ];