mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 19:07:59 +08:00
updated text test
This commit is contained in:
@@ -155,7 +155,7 @@ Test.Modules.Text = {
|
|||||||
layer.drawHit();
|
layer.drawHit();
|
||||||
|
|
||||||
},
|
},
|
||||||
'text multi line': function(containerId) {
|
'*text multi line': function(containerId) {
|
||||||
var stage = new Kinetic.Stage({
|
var stage = new Kinetic.Stage({
|
||||||
container: containerId,
|
container: containerId,
|
||||||
width: 578,
|
width: 578,
|
||||||
@@ -163,19 +163,27 @@ Test.Modules.Text = {
|
|||||||
});
|
});
|
||||||
var layer = new Kinetic.Layer();
|
var layer = new Kinetic.Layer();
|
||||||
|
|
||||||
|
var rect = new Kinetic.Rect({
|
||||||
|
x: 10,
|
||||||
|
y: 10,
|
||||||
|
width: 380,
|
||||||
|
height: 300,
|
||||||
|
fill: 'red'
|
||||||
|
});
|
||||||
|
|
||||||
var text = new Kinetic.Text({
|
var text = new Kinetic.Text({
|
||||||
x: 10,
|
x: 10,
|
||||||
y: 10,
|
y: 10,
|
||||||
text: 'HEADING\n\nAll the world\'s a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.',
|
text: 'HEADING\n\nAll the world\'s a stage, and all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts.',
|
||||||
//text: 'HEADING\n\nThis is a really cool paragraph. \n And this is a footer.',
|
//text: 'HEADING\n\nThis is a really cool paragraph. \n And this is a footer.',
|
||||||
fontSize: 16,
|
fontSize: 24,
|
||||||
fontFamily: 'Calibri',
|
fontFamily: 'Calibri',
|
||||||
fontStyle: 'normal',
|
fontStyle: 'normal',
|
||||||
fill: '#555',
|
fill: '#555',
|
||||||
//width: 20,
|
//width: 20,
|
||||||
width: 380,
|
width: 380,
|
||||||
//width: 200,
|
//width: 200,
|
||||||
padding: 20,
|
padding: 0,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
draggable: true
|
draggable: true
|
||||||
});
|
});
|
||||||
@@ -183,17 +191,23 @@ Test.Modules.Text = {
|
|||||||
// center text box
|
// center text box
|
||||||
//text.setOffset(text.getBoxWidth() / 2, text.getBoxHeight() / 2);
|
//text.setOffset(text.getBoxWidth() / 2, text.getBoxHeight() / 2);
|
||||||
|
|
||||||
layer.add(text);
|
layer.add(rect).add(text);
|
||||||
stage.add(layer);
|
stage.add(layer);
|
||||||
|
|
||||||
test(text.getLineHeight() === 1, 'text line height should be defaulted to 1');
|
test(text.getLineHeight() === 1, 'text line height should be defaulted to 1');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
text.transitionTo({
|
text.transitionTo({
|
||||||
width: 500,
|
width: 50,
|
||||||
duration: 10
|
duration: 20
|
||||||
|
});
|
||||||
|
|
||||||
|
rect.transitionTo({
|
||||||
|
width: 50,
|
||||||
|
duration: 20
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
},
|
},
|
||||||
'text multi line with shadows': function(containerId) {
|
'text multi line with shadows': function(containerId) {
|
||||||
var stage = new Kinetic.Stage({
|
var stage = new Kinetic.Stage({
|
||||||
|
Reference in New Issue
Block a user