mirror of
https://github.com/konvajs/konva.git
synced 2025-12-05 03:24:23 +08:00
introduced new setDefaultAttrs() method which greatly simplifies the logic required inside node constructors. This will also make plugin creation much easier
This commit is contained in:
12
src/Layer.js
12
src/Layer.js
@@ -10,11 +10,9 @@
|
||||
* @param {Object} config
|
||||
*/
|
||||
Kinetic.Layer = function(config) {
|
||||
// default attrs
|
||||
if(this.attrs === undefined) {
|
||||
this.attrs = {};
|
||||
}
|
||||
this.attrs.throttle = 12;
|
||||
this.setDefaultAttrs({
|
||||
throttle: 12
|
||||
});
|
||||
|
||||
this.nodeType = 'Layer';
|
||||
this.lastDrawTime = 0;
|
||||
@@ -51,13 +49,13 @@ Kinetic.Layer.prototype = {
|
||||
* @param {Number} throttle in ms
|
||||
*/
|
||||
setThrottle: function(throttle) {
|
||||
this.attrs.throttle = throttle;
|
||||
this.attrs.throttle = throttle;
|
||||
},
|
||||
/**
|
||||
* get throttle
|
||||
*/
|
||||
getThrottle: function() {
|
||||
return this.attrs.throttle;
|
||||
return this.attrs.throttle;
|
||||
},
|
||||
/**
|
||||
* clears the canvas context tied to the layer. Clearing
|
||||
|
||||
Reference in New Issue
Block a user