mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 15:23:44 +08:00
node@5.10.1, canvas@1.3.14, jsdom@8.5.0 support
This commit is contained in:
parent
9470bc5fe2
commit
2c772bfea4
@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## [Not released][Not released]
|
## [Not released][Not released]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- typescript definition in npm package
|
||||||
|
- node@5.10.1, canvas@1.3.14, jsdom@8.5.0 support
|
||||||
|
|
||||||
|
|
||||||
## [0.12.4][2016-04-19]
|
## [0.12.4][2016-04-19]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
14
README.md
14
README.md
@ -81,7 +81,7 @@ define(['./konva'], function(Konva) {
|
|||||||
###3 CommonJS style with npm:
|
###3 CommonJS style with npm:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install konva
|
npm install konva --save
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@ -110,18 +110,18 @@ import 'konva/src/shapes/rect';
|
|||||||
|
|
||||||
###5 NodeJS
|
###5 NodeJS
|
||||||
|
|
||||||
Support for node 0.12.x only for now.
|
|
||||||
You have to install some deps manually to use Konva in nodejs env.
|
You have to install some deps manually to use Konva in nodejs env.
|
||||||
|
|
||||||
We are using [node-canvas](https://github.com/LearnBoost/node-canvas) to create canvas element.
|
We are using [node-canvas](https://github.com/Automattic/node-canvas) to create canvas element.
|
||||||
|
|
||||||
1. Install node-canvas dependencies [https://github.com/LearnBoost/node-canvas/wiki/_pages](https://github.com/LearnBoost/node-canvas/wiki/_pages)
|
1. Install node-canvas dependencies [https://github.com/Automattic/node-canvas](https://github.com/Automattic/node-canvas)
|
||||||
2. `npm install canvas@1.2.x`
|
2. `npm install canvas --save`
|
||||||
2. `npm install jsdom@3.x` (jsdom v4 require iojs)
|
2. `npm install jsdom --save`
|
||||||
3. `npm install konva`
|
3. `npm install konva --save`
|
||||||
|
|
||||||
See file `resources/nodejs-demo.js` for example.
|
See file `resources/nodejs-demo.js` for example.
|
||||||
|
|
||||||
|
Last tested with node@5.10.1, canvas@1.3.14, jsdom@8.5.0
|
||||||
|
|
||||||
#Change log
|
#Change log
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
Konva = require('../dist/konva-dev');
|
Konva = require('konva');
|
||||||
|
|
||||||
|
|
||||||
// Create stage. Container parameter is not required in NodeJS.
|
// Create stage. Container parameter is not required in NodeJS.
|
||||||
@ -30,6 +30,7 @@ stage.setSize({
|
|||||||
height : 200
|
height : 200
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// check tween works
|
// check tween works
|
||||||
var tween = new Konva.Tween({
|
var tween = new Konva.Tween({
|
||||||
node : rect,
|
node : rect,
|
||||||
@ -67,4 +68,4 @@ setTimeout(function(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1050);
|
}, 1050);
|
||||||
|
@ -230,8 +230,8 @@
|
|||||||
var Canvas = require('canvas');
|
var Canvas = require('canvas');
|
||||||
var jsdom = require('jsdom').jsdom;
|
var jsdom = require('jsdom').jsdom;
|
||||||
|
|
||||||
Konva.document = jsdom('<!DOCTYPE html><html><head></head><body></body></html>');
|
Konva.window = jsdom('<!DOCTYPE html><html><head></head><body></body></html>').defaultView;
|
||||||
Konva.window = Konva.document.parentWindow;
|
Konva.document = Konva.window.document;
|
||||||
Konva.window.Image = Canvas.Image;
|
Konva.window.Image = Canvas.Image;
|
||||||
Konva._nodeCanvas = Canvas;
|
Konva._nodeCanvas = Canvas;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user