konva/konva-node/index.js

26 lines
507 B
JavaScript
Raw Normal View History

2017-10-19 17:45:28 +08:00
var Konva = require('konva');
2017-10-11 16:17:54 +08:00
var Canvas = require('canvas');
Konva.window = {
Image: Canvas.Image,
devicePixelRatio: 1
};
Konva.document = {
createElement: function() {},
documentElement: {
addEventListener: function() {}
}
};
2019-03-19 03:18:03 +08:00
Konva.window = new JSDOM(
'<!DOCTYPE html><html><head></head><body></body></html>'
).window;
Konva.document = Konva.window.document;
Konva.window.Image = Canvas.Image;
2019-04-04 07:08:16 +08:00
Konva.Util.createCanvasElement = () => {
return new Canvas();
};
2017-10-11 16:17:54 +08:00
module.exports = Konva;