added support for Factor getter setter validators

This commit is contained in:
Eric Rowell
2014-01-10 01:29:41 -08:00
parent 4b367ae2c8
commit 9e574fd241
15 changed files with 166 additions and 41 deletions

View File

@@ -337,7 +337,7 @@
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'blurRadius', 0, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'blurRadius', 0, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set blur radius

View File

@@ -21,7 +21,7 @@
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'brightness', 0, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'brightness', 0, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set filter brightness. The brightness is a number between -1 and 1.  Positive values
* brighten the pixels and negative values darken them.

View File

@@ -123,7 +123,7 @@
} while (--y);
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossStrength', 0.5, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossStrength', 0.5, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set emboss strength
* @name embossStrength
@@ -133,7 +133,7 @@
* @returns {Number}
*/
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossWhiteLevel', 0.5, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossWhiteLevel', 0.5, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set emboss white level
* @name embossWhiteLevel
@@ -143,7 +143,7 @@
* @returns {Number}
*/
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossDirection', 'top-left', function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossDirection', 'top-left', function(val) {this._filterUpToDate = false;return val;});
/**
* get/set emboss direction
* @name embossDirection
@@ -154,7 +154,7 @@
* @returns {String}
*/
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossBlend', false, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'embossBlend', false, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set emboss blend
* @name embossBlend

View File

@@ -105,7 +105,7 @@
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'enhance', 0, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'enhance', 0, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set enhance

View File

@@ -57,7 +57,7 @@
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'hue', 0, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'hue', 0, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set hsv hue in degrees
* @name hue
@@ -67,7 +67,7 @@
* @returns {Number}
*/
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'saturation', 1, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'saturation', 1, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set hsv saturation
* @name saturation
@@ -77,7 +77,7 @@
* @returns {Number}
*/
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'value', 1, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'value', 1, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set hsv value
* @name value

View File

@@ -310,8 +310,8 @@
FromPolar(scratchData,imageData,{polarRotation:0});
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'kaleidoscopePower', 2, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'kaleidoscopeAngle', 0, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'kaleidoscopePower', 2, function(val) {this._filterUpToDate = false;return val;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'kaleidoscopeAngle', 0, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set kaleidoscope power

View File

@@ -188,5 +188,5 @@
return imageData;
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'threshold', 0);
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'threshold', 0, function(val) {this._filterUpToDate = false;return val;});
})();

View File

@@ -21,7 +21,7 @@
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'noise', 0.2, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'noise', 0.2, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set noise amount. Must be a value between 0 and 1

View File

@@ -76,7 +76,7 @@
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'pixelSize', 8, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'pixelSize', 8, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set pixel size

View File

@@ -23,7 +23,7 @@
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'levels', 0.5, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'levels', 0.5, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set levels. Must be a number between 0 and 1

View File

@@ -23,7 +23,18 @@
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'red', 255, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'red', 0, function(val) {
this._filterUpToDate = false;
if (val > 255) {
return 255;
}
else if (val < 0) {
return 0;
}
else {
return Math.round(val);
}
});
/**
* get/set filter red value
* @name red
@@ -33,7 +44,18 @@
* @returns {Integer}
*/
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'green', 0, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'green', 0, function(val) {
this._filterUpToDate = false;
if (val > 255) {
return 255;
}
else if (val < 0) {
return 0;
}
else {
return Math.round(val);
}
});
/**
* get/set filter green value
* @name green
@@ -43,7 +65,18 @@
* @returns {Integer}
*/
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'blue', 0, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'blue', 0, function(val) {
this._filterUpToDate = false;
if (val > 255) {
return 255;
}
else if (val < 0) {
return 0;
}
else {
return Math.round(val);
}
});
/**
* get/set filter blue value
* @name blue

View File

@@ -21,7 +21,7 @@
}
};
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'threshold', 0.5, function() {this._filterUpToDate = false;});
Kinetic.Factory.addGetterSetter(Kinetic.Node, 'threshold', 0.5, function(val) {this._filterUpToDate = false;return val;});
/**
* get/set threshold. Must be a value between 0 and 1