mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
update CHANGELOG with new version
This commit is contained in:
parent
e6c1bd4e78
commit
baf3769774
@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [Not released][Not released]
|
## [Not released][Not released]
|
||||||
|
|
||||||
|
## [1.2.0][2016-09-15]
|
||||||
|
|
||||||
|
## Added
|
||||||
|
- new properties for `Konva.TextPath`: `letterSpacing` and `textBaseline`.
|
||||||
|
|
||||||
## [1.1.4][2016-09-13]
|
## [1.1.4][2016-09-13]
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -66,14 +66,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// update text data for certain attr changes
|
// update text data for certain attr changes
|
||||||
this.on('textChange.konva textStroke.konva textStrokeWidth.konva', that._setTextData);
|
this.on('textChange.konva textStroke.konva textStrokeWidth.konva letterSpacing.konva', that._setTextData);
|
||||||
that._setTextData();
|
that._setTextData();
|
||||||
this.sceneFunc(this._sceneFunc);
|
this.sceneFunc(this._sceneFunc);
|
||||||
this.hitFunc(this._hitFunc);
|
this.hitFunc(this._hitFunc);
|
||||||
},
|
},
|
||||||
_sceneFunc: function(context) {
|
_sceneFunc: function(context) {
|
||||||
context.setAttr('font', this._getContextFont());
|
context.setAttr('font', this._getContextFont());
|
||||||
context.setAttr('textBaseline', 'middle');
|
context.setAttr(this.getTextBaseline(), 'middle');
|
||||||
context.setAttr('textAlign', 'left');
|
context.setAttr('textAlign', 'left');
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
@ -164,6 +164,8 @@
|
|||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
var size = this._getTextSize(this.attrs.text);
|
var size = this._getTextSize(this.attrs.text);
|
||||||
|
var letterSpacing = this.getLetterSpacing();
|
||||||
|
|
||||||
this.textWidth = size.width;
|
this.textWidth = size.width;
|
||||||
this.textHeight = size.height;
|
this.textHeight = size.height;
|
||||||
|
|
||||||
@ -198,7 +200,7 @@
|
|||||||
};
|
};
|
||||||
var findSegmentToFitCharacter = function(c) {
|
var findSegmentToFitCharacter = function(c) {
|
||||||
|
|
||||||
var glyphWidth = that._getTextSize(c).width;
|
var glyphWidth = that._getTextSize(c).width + letterSpacing;
|
||||||
|
|
||||||
var currLen = 0;
|
var currLen = 0;
|
||||||
var attempts = 0;
|
var attempts = 0;
|
||||||
@ -422,6 +424,27 @@
|
|||||||
* @param {String} fontStyle
|
* @param {String} fontStyle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Konva.Factory.addGetterSetter(Konva.TextPath, 'letterSpacing', 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set letter spacing property. Default value is 0.
|
||||||
|
* @name letterSpacing
|
||||||
|
* @method
|
||||||
|
* @memberof Konva.TextPath.prototype
|
||||||
|
* @param {Number} letterSpacing
|
||||||
|
*/
|
||||||
|
|
||||||
|
Konva.Factory.addGetterSetter(Konva.TextPath, 'textBaseline', 'middle');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set textBaseline property. Default value is 'middle'.
|
||||||
|
* Can be 'top', 'bottom', 'middle', 'alphabetic', 'hanging'
|
||||||
|
* @name textBaseline
|
||||||
|
* @method
|
||||||
|
* @memberof Konva.TextPath.prototype
|
||||||
|
* @param {Number} textBaseline
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get font style
|
* get font style
|
||||||
* @name getFontStyle
|
* @name getFontStyle
|
||||||
@ -431,6 +454,8 @@
|
|||||||
|
|
||||||
Konva.Factory.addGetterSetter(Konva.TextPath, 'fontVariant', NORMAL);
|
Konva.Factory.addGetterSetter(Konva.TextPath, 'fontVariant', NORMAL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set font variant. Can be 'normal' or 'small-caps'. 'normal' is the default.
|
* set font variant. Can be 'normal' or 'small-caps'. 'normal' is the default.
|
||||||
* @name setFontVariant
|
* @name setFontVariant
|
||||||
|
@ -215,4 +215,29 @@ suite('TextPath', function() {
|
|||||||
cloneAndCompareLayer(layer,50);
|
cloneAndCompareLayer(layer,50);
|
||||||
showHit(layer);
|
showHit(layer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Text path with letter spacing', function() {
|
||||||
|
var stage = addStage();
|
||||||
|
var layer = new Konva.Layer();
|
||||||
|
|
||||||
|
var c = "M10,10 C0,0 10,150 100,100 S300,150 400,50";
|
||||||
|
|
||||||
|
var textpath = new Konva.TextPath({
|
||||||
|
stroke: 'black',
|
||||||
|
strokeWidth: 1,
|
||||||
|
fill: 'orange',
|
||||||
|
fontSize: 10,
|
||||||
|
fontFamily: 'Arial',
|
||||||
|
letterSpacing: 5,
|
||||||
|
text: 'All the world\'s a stage, and all the men and women merely players.',
|
||||||
|
data: c
|
||||||
|
});
|
||||||
|
|
||||||
|
textpath.cache();
|
||||||
|
|
||||||
|
layer.add(textpath);
|
||||||
|
stage.add(layer);
|
||||||
|
cloneAndCompareLayer(layer,50);
|
||||||
|
showHit(layer);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user