4 ms·
Aren’t these textures already reusable? The constructed texture object (the result of textures.lines(), e.g.) can be called on as many selections as you like to
by mbostock 12y ago
Aren’t these textures already reusable? The constructed texture object (the result of textures.lines(), e.g.) can be called on as many selections as you like to reuse it.
I feel it’s a matter of taste, but one practical reason I prefer chaining to configuration objects is that you get a runtime error when you misspell a property, rather than it being silently ignored.
- ttty 12y agoImage you have an UI which talks to this. For example you have a button on/off. How would you do? var t = texture().lines().stroke('red') if(this.button.on) t= texture.heavier() Compare the previous with this one. var t = texture({lines: true, heavier: this.button.on, stroke: 'red'}) I also hate the non standard constructor: this should be like this var texture = new Texture({lines: true, heavier: this.button.on, stroke: 'red'});