mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 06:55:17 +08:00
changing the font size now correctly updates the text data
This commit is contained in:
parent
b7ac415ea6
commit
ed8c5ab6b8
2
dist/kinetic-core.js
vendored
2
dist/kinetic-core.js
vendored
@ -4883,7 +4883,7 @@ Kinetic.Text = Kinetic.Shape.extend({
|
||||
this._super(config);
|
||||
|
||||
// update text data for certain attr changes
|
||||
var attrs = ['width', 'height', 'padding', 'text', 'textStroke', 'textStrokeWidth'];
|
||||
var attrs = ['fontFamily', 'fontSize', 'fontStyle', 'padding', 'align', 'lineHeight', 'text', 'width', 'height'];
|
||||
var that = this;
|
||||
for(var n = 0; n < attrs.length; n++) {
|
||||
var attr = attrs[n];
|
||||
|
2
dist/kinetic-core.min.js
vendored
2
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
@ -32,7 +32,7 @@ Kinetic.Text = Kinetic.Shape.extend({
|
||||
this._super(config);
|
||||
|
||||
// update text data for certain attr changes
|
||||
var attrs = ['width', 'height', 'padding', 'text', 'textStroke', 'textStrokeWidth'];
|
||||
var attrs = ['fontFamily', 'fontSize', 'fontStyle', 'padding', 'align', 'lineHeight', 'text', 'width', 'height'];
|
||||
var that = this;
|
||||
for(var n = 0; n < attrs.length; n++) {
|
||||
var attr = attrs[n];
|
||||
|
@ -2847,6 +2847,42 @@ Test.prototype.tests = {
|
||||
});
|
||||
*/
|
||||
},
|
||||
'SHAPE - change font size should update text data': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var text = new Kinetic.Text({
|
||||
x: 10,
|
||||
y: 10,
|
||||
fill: '#ddd',
|
||||
text: 'Some awesome text',
|
||||
fontSize: 16,
|
||||
fontFamily: 'Calibri',
|
||||
fontStyle: 'normal',
|
||||
textFill: '#555',
|
||||
align: 'center',
|
||||
padding: 5,
|
||||
draggable: true,
|
||||
detectionType: 'path'
|
||||
});
|
||||
|
||||
var width = text.getBoxWidth();
|
||||
var height = text.getBoxHeight();
|
||||
|
||||
layer.add(text);
|
||||
stage.add(layer);
|
||||
|
||||
text.setFontSize(30);
|
||||
layer.draw();
|
||||
|
||||
test(text.getBoxWidth() > width, 'text box width should have increased.');
|
||||
test(text.getBoxHeight() > height, 'text box height should have increased.');
|
||||
|
||||
},
|
||||
'SHAPE - get shape name': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
Loading…
Reference in New Issue
Block a user