mirror of
https://github.com/konvajs/konva.git
synced 2025-04-04 10:20:36 +08:00
nodejs fixes, bugs fixes
This commit is contained in:
parent
7860aedeeb
commit
734a66a75c
20
CHANGELOG.md
20
CHANGELOG.md
@ -5,15 +5,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## **NOT RELEASED V8**
|
||||
|
||||
This is going to be a very large release.
|
||||
|
||||
**BREAKING:**
|
||||
|
||||
- `Konva.Collection` is removed. `container.children` is a simple array now. `container.find()` will return also a simple array instead of `Konva.Collection()`.
|
||||
- argument `selector` is removed from `node.getIntersection(pos)` API
|
||||
- `Konva.Util.extend` is removed
|
||||
- `Konva.Collection` is removed. `container.children` is a simple array now. `container.find()` will returns an array instead of `Konva.Collection()` instance.
|
||||
`Konva.Collection` was confusing for many users. Also it was slow and worked with a bit of magic. So I decided to get rif of it. Now we are going to use good old arrays.
|
||||
|
||||
```js
|
||||
// old code:
|
||||
group.find('Shape').visible(false);
|
||||
|
||||
// new code:
|
||||
group.find('Shape').forEach((shape) => shape.visible(false));
|
||||
```
|
||||
|
||||
- argument `selector` is removed from `node.getIntersection(pos)` API. I don't think you knew about it.
|
||||
- `Konva.Util.extend` is removed.
|
||||
|
||||
**New features:**
|
||||
|
||||
- All updates on canvas will do automatic redraw with `layer.batchDraw()`. This features is configurable with `Konva.autoDrawEnbaled` property
|
||||
- All updates on canvas will do automatic redraw with `layer.batchDraw()`. This features is configurable with `Konva.autoDrawEnbaled` property.
|
||||
- New method `layer.getNativeCanvasElement()`
|
||||
- new `flipEnabled` property for `Konva.Transformer`
|
||||
- new `node.isClientRectOnScreen()` method
|
||||
|
@ -1,8 +1,8 @@
|
||||
var fs = require('fs');
|
||||
import fs from 'fs';
|
||||
|
||||
// relative path here
|
||||
// but you will need just require('konva-node');
|
||||
var Konva = require('./');
|
||||
import Konva from '../';
|
||||
|
||||
// Create stage. Container parameter is not required in NodeJS.
|
||||
var stage = new Konva.Stage({
|
||||
|
@ -6,6 +6,7 @@
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"type": "module",
|
||||
"typings": "./node_modules/konva/konva.d.ts",
|
||||
"scripts": {},
|
||||
"keywords": [
|
||||
|
6
konva.js
6
konva.js
@ -5,7 +5,7 @@
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
/*
|
||||
* Konva JavaScript Framework v7.2.5
|
||||
* Konva JavaScript Framework v8.0.0-0
|
||||
* http://konvajs.org/
|
||||
* Licensed under the MIT
|
||||
* Date: Sun May 09 2021
|
||||
@ -35,7 +35,7 @@
|
||||
: {};
|
||||
const Konva$2 = {
|
||||
_global: glob,
|
||||
version: '7.2.5',
|
||||
version: '8.0.0-0',
|
||||
isBrowser: detectBrowser(),
|
||||
isUnminified: /param/.test(function (param) { }.toString()),
|
||||
dblClickWindow: 400,
|
||||
@ -15500,7 +15500,7 @@
|
||||
* // get flip enabled property
|
||||
* var flipEnabled = transformer.flipEnabled();
|
||||
*
|
||||
* // set handlers
|
||||
* // set flip enabled property
|
||||
* transformer.flipEnabled(false);
|
||||
*/
|
||||
Factory.addGetterSetter(Transformer, 'flipEnabled', true, getBooleanValidator());
|
||||
|
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "konva",
|
||||
"version": "7.2.5",
|
||||
"version": "8.0.0-0",
|
||||
"author": "Anton Lavrenov",
|
||||
"files": [
|
||||
"README.md",
|
||||
|
@ -18,11 +18,10 @@ files.then((filePaths) => {
|
||||
|
||||
// stupid replacement back
|
||||
text = text.replace(
|
||||
"import * as canvas from 'canvas.js';",
|
||||
"import * as canvas from 'canvas';"
|
||||
"import * as Canvas from 'canvas.js';",
|
||||
"import * as Canvas from 'canvas';"
|
||||
);
|
||||
|
||||
console.log(`writing to ${filepath}`);
|
||||
fs.writeFile(filepath, text, function (err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
|
@ -803,13 +803,13 @@ export const Util = {
|
||||
Util.warn(
|
||||
'Util._degToRad is removed. Please use public Util.degToRad instead.'
|
||||
);
|
||||
return Util._degToRad(deg);
|
||||
return Util.degToRad(deg);
|
||||
},
|
||||
_radToDeg(rad: number) {
|
||||
Util.warn(
|
||||
'Util._radToDeg is removed. Please use public Util.radToDeg instead.'
|
||||
);
|
||||
return Util._radToDeg(rad);
|
||||
return Util.radToDeg(rad);
|
||||
},
|
||||
_getRotation(radians) {
|
||||
return Konva.angleDeg ? Util.radToDeg(radians) : radians;
|
||||
|
@ -1,6 +1,8 @@
|
||||
// main entry for umd build for rollup
|
||||
import { Konva } from './_FullInternals';
|
||||
import * as canvas from 'canvas';
|
||||
import * as Canvas from 'canvas';
|
||||
|
||||
const canvas = Canvas['default'] || Canvas;
|
||||
|
||||
const isNode = typeof global.document === 'undefined';
|
||||
|
||||
|
@ -1279,7 +1279,7 @@ Factory.addGetterSetter(
|
||||
* // get flip enabled property
|
||||
* var flipEnabled = transformer.flipEnabled();
|
||||
*
|
||||
* // set handlers
|
||||
* // set flip enabled property
|
||||
* transformer.flipEnabled(false);
|
||||
*/
|
||||
Factory.addGetterSetter(
|
||||
|
@ -22,4 +22,6 @@ equal(Konva2.Rect, Rect, 'Rect is injected');
|
||||
|
||||
equal(Konva2, Konva, 'Same Konva');
|
||||
|
||||
console.log('Import tests are passed.');
|
||||
// just do a simple action
|
||||
const stage = new Konva.Stage();
|
||||
stage.toDataURL();
|
||||
|
Loading…
Reference in New Issue
Block a user