some new files

This commit is contained in:
Anton Lavrenov
2019-08-04 14:39:13 +07:00
parent 34f0f4ae33
commit 7df6fc4f3f
2 changed files with 185 additions and 0 deletions

33
test/worker.js Normal file
View File

@@ -0,0 +1,33 @@
// Can we start Konva inside worker?
importScripts('../../konva.js');
console.log(Konva);
Konva.Util.createCanvasElement = () => {
const canvas = new OffscreenCanvas(100, 100);
canvas.style = {};
return canvas;
};
Konva.Canvas.prototype.setSize = function(width, height) {
this.setWidth(width || 1);
this.setHeight(height || 1);
};
Konva.Stage.prototype._checkVisibility = function() {};
var stage = new Konva.Stage({
width: 100,
height: 100
});
var layer = new Konva.Layer();
stage.add(layer);
var shape = new Konva.Circle({
x: stage.width() / 2,
y: stage.height() / 2,
radius: 50,
fill: 'red'
});
layer.add(shape);