remove some deprecations

This commit is contained in:
Anton Lavrenov 2018-03-10 09:56:27 +07:00
parent a91e00fc05
commit 0363090052
4 changed files with 133 additions and 274 deletions

View File

@ -10,7 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* new `Konva.Transformer` group that allow simple resize, and rotate of a shape.
* Add ability to remove event by callback `node.off('event', callback)`.
* new `Konva.Filters.Contrast`.
* new `Konva.Util.haveIntersection()` to detect collusion
* new `Konva.Util.haveIntersection()` to detect simple collusion
* add `Konva.Text.ellipsis` to add '…' to text string if width is fixed and wrap is set to 'none'
* add gradients for strokes
@ -23,6 +23,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Some typescript fixes
* Pixelate filter fixes
## Removed
* Some deprecated methods are removed. If previous version was working without deprecation warnings for you, this one will work fine too.
## [1.7.6][2017-11-01]
## Fixed

305
konva.js
View File

@ -2254,7 +2254,10 @@
};
},
addDeprecatedGetterSetter: function(constructor, attr, def, validator) {
Konva.Util.error('Adding deprecated ' + attr);
var method = GET + Konva.Util._capitalize(attr);
var message =
attr +
' property is deprecated and will be removed soon. Look at Konva change log for more information.';
@ -8431,7 +8434,12 @@
* @returns {Boolean}
*/
hasStroke: function() {
return this.strokeEnabled() && !!this.stroke();
return (
this.strokeEnabled() &&
!!(this.stroke() || this.getStrokeLinearGradientColorStops())
// TODO: do we need radial gradient
// this.getStrokeRadialGradientColorStops()
);
},
/**
* determines if point is in the shape, regardless if other shapes are on top of it. Note: because
@ -8797,31 +8805,6 @@
* shape.stroke('rgba(0,255,0,0.5');
*/
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeRed',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeGreen',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeBlue',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeAlpha',
1,
Konva.Validators.alphaComponent
);
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeWidth', 2);
/**
@ -9037,31 +9020,6 @@
* shape.shadowColor('rgba(0,255,0,0.5');
*/
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowRed',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowGreen',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowBlue',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowAlpha',
1,
Konva.Validators.alphaComponent
);
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowBlur');
/**
@ -9205,31 +9163,6 @@
* shape.fill(null);
*/
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillRed',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillGreen',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillBlue',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillAlpha',
1,
Konva.Validators.alphaComponent
);
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternX', 0);
/**
@ -9280,23 +9213,23 @@
* shape.fillLinearGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');
*/
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeLinearGradientColorStops');
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeLinearGradientColorStops');
/**
* get/set stroke linear gradient color stops
* @name strokeLinearGradientColorStops
* @method
* @memberof Konva.Shape.prototype
* @param {Array} colorStops
* @returns {Array} colorStops
* @example
* // get stroke linear gradient color stops
* var colorStops = shape.strokeLinearGradientColorStops();
*
* // create a linear gradient that starts with red, changes to blue
* // halfway through, and then changes to green
* shape.strokeLinearGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');
*/
/**
* get/set stroke linear gradient color stops
* @name strokeLinearGradientColorStops
* @method
* @memberof Konva.Shape.prototype
* @param {Array} colorStops
* @returns {Array} colorStops
* @example
* // get stroke linear gradient color stops
* var colorStops = shape.strokeLinearGradientColorStops();
*
* // create a linear gradient that starts with red, changes to blue
* // halfway through, and then changes to green
* shape.strokeLinearGradientColorStops([0, 'red', 0.5, 'blue', 1, 'green']);
*/
Konva.Factory.addGetterSetter(
Konva.Shape,
@ -9643,24 +9576,24 @@
);
/**
* get/set stroke linear gradient start point
* @name strokeLinearGradientStartPoint
* @method
* @memberof Konva.Shape.prototype
* @param {Object} startPoint
* @param {Number} startPoint.x
* @param {Number} startPoint.y
* @returns {Object}
* @example
* // get stroke linear gradient start point
* var startPoint = shape.strokeLinearGradientStartPoint();
*
* // set stroke linear gradient start point
* shape.strokeLinearGradientStartPoint({
* x: 20
* y: 10
* });
*/
* get/set stroke linear gradient start point
* @name strokeLinearGradientStartPoint
* @method
* @memberof Konva.Shape.prototype
* @param {Object} startPoint
* @param {Number} startPoint.x
* @param {Number} startPoint.y
* @returns {Object}
* @example
* // get stroke linear gradient start point
* var startPoint = shape.strokeLinearGradientStartPoint();
*
* // set stroke linear gradient start point
* shape.strokeLinearGradientStartPoint({
* x: 20
* y: 10
* });
*/
Konva.Factory.addGetterSetter(
Konva.Shape,
@ -9690,19 +9623,19 @@
);
/**
* get/set stroke linear gradient start point x
* @name linearLinearGradientStartPointX
* @method
* @memberof Konva.Shape.prototype
* @param {Number} x
* @returns {Number}
* @example
* // get stroke linear gradient start point x
* var startPointX = shape.strokeLinearGradientStartPointX();
*
* // set stroke linear gradient start point x
* shape.strokeLinearGradientStartPointX(20);
*/
* get/set stroke linear gradient start point x
* @name linearLinearGradientStartPointX
* @method
* @memberof Konva.Shape.prototype
* @param {Number} x
* @returns {Number}
* @example
* // get stroke linear gradient start point x
* var startPointX = shape.strokeLinearGradientStartPointX();
*
* // set stroke linear gradient start point x
* shape.strokeLinearGradientStartPointX(20);
*/
Konva.Factory.addGetterSetter(
Konva.Shape,
@ -9731,19 +9664,19 @@
0
);
/**
* get/set stroke linear gradient start point y
* @name strokeLinearGradientStartPointY
* @method
* @memberof Konva.Shape.prototype
* @param {Number} y
* @returns {Number}
* @example
* // get stroke linear gradient start point y
* var startPointY = shape.strokeLinearGradientStartPointY();
*
* // set stroke linear gradient start point y
* shape.strokeLinearGradientStartPointY(20);
*/
* get/set stroke linear gradient start point y
* @name strokeLinearGradientStartPointY
* @method
* @memberof Konva.Shape.prototype
* @param {Number} y
* @returns {Number}
* @example
* // get stroke linear gradient start point y
* var startPointY = shape.strokeLinearGradientStartPointY();
*
* // set stroke linear gradient start point y
* shape.strokeLinearGradientStartPointY(20);
*/
Konva.Factory.addComponentsGetterSetter(
Konva.Shape,
@ -9778,24 +9711,24 @@
);
/**
* get/set stroke linear gradient end point
* @name strokeLinearGradientEndPoint
* @method
* @memberof Konva.Shape.prototype
* @param {Object} endPoint
* @param {Number} endPoint.x
* @param {Number} endPoint.y
* @returns {Object}
* @example
* // get stroke linear gradient end point
* var endPoint = shape.strokeLinearGradientEndPoint();
*
* // set stroke linear gradient end point
* shape.strokeLinearGradientEndPoint({
* x: 20
* y: 10
* });
*/
* get/set stroke linear gradient end point
* @name strokeLinearGradientEndPoint
* @method
* @memberof Konva.Shape.prototype
* @param {Object} endPoint
* @param {Number} endPoint.x
* @param {Number} endPoint.y
* @returns {Object}
* @example
* // get stroke linear gradient end point
* var endPoint = shape.strokeLinearGradientEndPoint();
*
* // set stroke linear gradient end point
* shape.strokeLinearGradientEndPoint({
* x: 20
* y: 10
* });
*/
Konva.Factory.addGetterSetter(Konva.Shape, 'fillLinearGradientEndPointX', 0);
/**
@ -9813,21 +9746,25 @@
* shape.fillLinearGradientEndPointX(20);
*/
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeLinearGradientEndPointX', 0);
Konva.Factory.addGetterSetter(
Konva.Shape,
'strokeLinearGradientEndPointX',
0
);
/**
* get/set fill linear gradient end point x
* @name strokeLinearGradientEndPointX
* @method
* @memberof Konva.Shape.prototype
* @param {Number} x
* @returns {Number}
* @example
* // get stroke linear gradient end point x
* var endPointX = shape.strokeLinearGradientEndPointX();
*
* // set stroke linear gradient end point x
* shape.strokeLinearGradientEndPointX(20);
*/
* get/set fill linear gradient end point x
* @name strokeLinearGradientEndPointX
* @method
* @memberof Konva.Shape.prototype
* @param {Number} x
* @returns {Number}
* @example
* // get stroke linear gradient end point x
* var endPointX = shape.strokeLinearGradientEndPointX();
*
* // set stroke linear gradient end point x
* shape.strokeLinearGradientEndPointX(20);
*/
Konva.Factory.addGetterSetter(Konva.Shape, 'fillLinearGradientEndPointY', 0);
/**
@ -9845,21 +9782,25 @@
* shape.fillLinearGradientEndPointY(20);
*/
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeLinearGradientEndPointY', 0);
Konva.Factory.addGetterSetter(
Konva.Shape,
'strokeLinearGradientEndPointY',
0
);
/**
* get/set stroke linear gradient end point y
* @name strokeLinearGradientEndPointY
* @method
* @memberof Konva.Shape.prototype
* @param {Number} y
* @returns {Number}
* @example
* // get stroke linear gradient end point y
* var endPointY = shape.strokeLinearGradientEndPointY();
*
* // set stroke linear gradient end point y
* shape.strokeLinearGradientEndPointY(20);
*/
* get/set stroke linear gradient end point y
* @name strokeLinearGradientEndPointY
* @method
* @memberof Konva.Shape.prototype
* @param {Number} y
* @returns {Number}
* @example
* // get stroke linear gradient end point y
* var endPointY = shape.strokeLinearGradientEndPointY();
*
* // set stroke linear gradient end point y
* shape.strokeLinearGradientEndPointY(20);
*/
Konva.Factory.addComponentsGetterSetter(
Konva.Shape,

13
konva.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -175,11 +175,9 @@
hasStroke: function() {
return (
this.strokeEnabled() &&
!!(
this.stroke() ||
this.getStrokeLinearGradientColorStops() ||
this.getStrokeRadialGradientColorStops()
)
!!(this.stroke() || this.getStrokeLinearGradientColorStops())
// TODO: do we need radial gradient
// this.getStrokeRadialGradientColorStops()
);
},
/**
@ -546,31 +544,6 @@
* shape.stroke('rgba(0,255,0,0.5');
*/
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeRed',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeGreen',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeBlue',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'strokeAlpha',
1,
Konva.Validators.alphaComponent
);
Konva.Factory.addGetterSetter(Konva.Shape, 'strokeWidth', 2);
/**
@ -786,31 +759,6 @@
* shape.shadowColor('rgba(0,255,0,0.5');
*/
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowRed',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowGreen',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowBlue',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'shadowAlpha',
1,
Konva.Validators.alphaComponent
);
Konva.Factory.addGetterSetter(Konva.Shape, 'shadowBlur');
/**
@ -954,31 +902,6 @@
* shape.fill(null);
*/
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillRed',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillGreen',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillBlue',
0,
Konva.Validators.RGBComponent
);
Konva.Factory.addDeprecatedGetterSetter(
Konva.Shape,
'fillAlpha',
1,
Konva.Validators.alphaComponent
);
Konva.Factory.addGetterSetter(Konva.Shape, 'fillPatternX', 0);
/**