mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 18:27:58 +08:00
finished up new Scene and Hit Renderers. added new textShadow attrs for more flexibility. Added new fillStroke() method which encapsulates shadow application logic
This commit is contained in:
@@ -96,11 +96,11 @@ Test.Modules.SHAPE = {
|
||||
});
|
||||
|
||||
stage.add(layer.add(triangle));
|
||||
|
||||
|
||||
warn(layer.toDataURL() === customShapeTwoFills, 'problem with custom shape with two fills');
|
||||
|
||||
},
|
||||
'custom shape with fill, stroke, and strokeWidth': function(containerId) {
|
||||
'custom shape with fill, stroke, and strokeWidth': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
@@ -141,7 +141,8 @@ Test.Modules.SHAPE = {
|
||||
context.lineTo(100, 0);
|
||||
context.lineTo(100, 100);
|
||||
context.closePath();
|
||||
this.render(context);
|
||||
this.fill(context);
|
||||
this.stroke(context);
|
||||
},
|
||||
x: 200,
|
||||
y: 100,
|
||||
@@ -156,7 +157,8 @@ Test.Modules.SHAPE = {
|
||||
context.lineTo(200, 0);
|
||||
context.lineTo(200, 100);
|
||||
context.closePath();
|
||||
this.render(context);
|
||||
this.fill(context);
|
||||
this.stroke(context);
|
||||
});
|
||||
var rect = new Kinetic.Rect({
|
||||
x: 10,
|
||||
@@ -175,7 +177,8 @@ Test.Modules.SHAPE = {
|
||||
context.lineTo(200, 0);
|
||||
context.lineTo(200, 100);
|
||||
context.closePath();
|
||||
this.render(context);
|
||||
this.fill(context);
|
||||
this.stroke(context);
|
||||
});
|
||||
|
||||
layer.add(shape);
|
||||
|
@@ -1,4 +1,53 @@
|
||||
Test.Modules.Text = {
|
||||
'add text with shadows': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
height: 200
|
||||
});
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var text = new Kinetic.Text({
|
||||
x: stage.getWidth() / 2,
|
||||
y: stage.getHeight() / 2,
|
||||
stroke: '#555',
|
||||
strokeWidth: 5,
|
||||
fill: '#ddd',
|
||||
text: 'Hello World!',
|
||||
fontSize: 50,
|
||||
fontFamily: 'Calibri',
|
||||
fontStyle: 'normal',
|
||||
textFill: '#888',
|
||||
textStroke: '#333',
|
||||
align: 'right',
|
||||
lineHeight: 1.2,
|
||||
width: 400,
|
||||
height: 100,
|
||||
padding: 10,
|
||||
|
||||
shadow: {
|
||||
color: 'black',
|
||||
blur: 1,
|
||||
offset: [10, 10],
|
||||
opacity: 0.2
|
||||
},
|
||||
textShadow: {
|
||||
color: 'red',
|
||||
blur: 1,
|
||||
offset: [10, 10],
|
||||
opacity: 0.2
|
||||
},
|
||||
|
||||
cornerRadius: 10,
|
||||
draggable: true
|
||||
});
|
||||
|
||||
// center text box
|
||||
text.setOffset(text.getWidth() / 2, text.getHeight() / 2);
|
||||
|
||||
layer.add(text);
|
||||
stage.add(layer);
|
||||
},
|
||||
'text getters and setters': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
|
Reference in New Issue
Block a user