mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
Merge pull request #684 from lavrton/toImageImprovement
toImage improvement
This commit is contained in:
@@ -1005,8 +1005,8 @@
|
|||||||
x = config.x || 0,
|
x = config.x || 0,
|
||||||
y = config.y || 0,
|
y = config.y || 0,
|
||||||
canvas = new Kinetic.SceneCanvas({
|
canvas = new Kinetic.SceneCanvas({
|
||||||
width: config.width || stage.getWidth(),
|
width: config.width || this.getWidth() || (stage ? stage.getWidth() : 0),
|
||||||
height: config.height || stage.getHeight(),
|
height: config.height || this.getHeight() || (stage ? stage.getHeight() : 0),
|
||||||
pixelRatio: 1
|
pixelRatio: 1
|
||||||
}),
|
}),
|
||||||
context = canvas.getContext();
|
context = canvas.getContext();
|
||||||
|
@@ -933,6 +933,39 @@ suite('Node', function() {
|
|||||||
showHit(layer);
|
showHit(layer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ======================================================
|
||||||
|
test('node caching width minimal configuration', function(done) {
|
||||||
|
var stage = addStage();
|
||||||
|
var layer = new Kinetic.Layer();
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
var rect = new Kinetic.Rect({
|
||||||
|
width : 50,
|
||||||
|
height : 50,
|
||||||
|
fill: 'green',
|
||||||
|
stroke: 'blue',
|
||||||
|
strokeWidth: 5,
|
||||||
|
draggable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
rect.toImage({
|
||||||
|
callback: function(imageObj) {
|
||||||
|
assert.equal(Kinetic.Util._isElement(imageObj), true);
|
||||||
|
var cachedShape = new Kinetic.Image({
|
||||||
|
image: imageObj,
|
||||||
|
draggable: true,
|
||||||
|
stroke: 'red',
|
||||||
|
strokeWidth: 5
|
||||||
|
});
|
||||||
|
|
||||||
|
layer.add(cachedShape);
|
||||||
|
layer.draw();
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
showHit(layer);
|
||||||
|
});
|
||||||
// ======================================================
|
// ======================================================
|
||||||
test('hide group', function() {
|
test('hide group', function() {
|
||||||
var stage = addStage();
|
var stage = addStage();
|
||||||
|
Reference in New Issue
Block a user