mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +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**
|
## **NOT RELEASED V8**
|
||||||
|
|
||||||
|
This is going to be a very large release.
|
||||||
|
|
||||||
**BREAKING:**
|
**BREAKING:**
|
||||||
|
|
||||||
- `Konva.Collection` is removed. `container.children` is a simple array now. `container.find()` will return also a simple array instead of `Konva.Collection()`.
|
- `Konva.Collection` is removed. `container.children` is a simple array now. `container.find()` will returns an array instead of `Konva.Collection()` instance.
|
||||||
- argument `selector` is removed from `node.getIntersection(pos)` API
|
`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.
|
||||||
- `Konva.Util.extend` is removed
|
|
||||||
|
```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:**
|
**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 method `layer.getNativeCanvasElement()`
|
||||||
- new `flipEnabled` property for `Konva.Transformer`
|
- new `flipEnabled` property for `Konva.Transformer`
|
||||||
- new `node.isClientRectOnScreen()` method
|
- new `node.isClientRectOnScreen()` method
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
var fs = require('fs');
|
import fs from 'fs';
|
||||||
|
|
||||||
// relative path here
|
// relative path here
|
||||||
// but you will need just require('konva-node');
|
// but you will need just require('konva-node');
|
||||||
var Konva = require('./');
|
import Konva from '../';
|
||||||
|
|
||||||
// Create stage. Container parameter is not required in NodeJS.
|
// Create stage. Container parameter is not required in NodeJS.
|
||||||
var stage = new Konva.Stage({
|
var stage = new Konva.Stage({
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"index.js"
|
"index.js"
|
||||||
],
|
],
|
||||||
|
"type": "module",
|
||||||
"typings": "./node_modules/konva/konva.d.ts",
|
"typings": "./node_modules/konva/konva.d.ts",
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
6
konva.js
6
konva.js
@ -5,7 +5,7 @@
|
|||||||
}(this, (function () { 'use strict';
|
}(this, (function () { 'use strict';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Konva JavaScript Framework v7.2.5
|
* Konva JavaScript Framework v8.0.0-0
|
||||||
* http://konvajs.org/
|
* http://konvajs.org/
|
||||||
* Licensed under the MIT
|
* Licensed under the MIT
|
||||||
* Date: Sun May 09 2021
|
* Date: Sun May 09 2021
|
||||||
@ -35,7 +35,7 @@
|
|||||||
: {};
|
: {};
|
||||||
const Konva$2 = {
|
const Konva$2 = {
|
||||||
_global: glob,
|
_global: glob,
|
||||||
version: '7.2.5',
|
version: '8.0.0-0',
|
||||||
isBrowser: detectBrowser(),
|
isBrowser: detectBrowser(),
|
||||||
isUnminified: /param/.test(function (param) { }.toString()),
|
isUnminified: /param/.test(function (param) { }.toString()),
|
||||||
dblClickWindow: 400,
|
dblClickWindow: 400,
|
||||||
@ -15500,7 +15500,7 @@
|
|||||||
* // get flip enabled property
|
* // get flip enabled property
|
||||||
* var flipEnabled = transformer.flipEnabled();
|
* var flipEnabled = transformer.flipEnabled();
|
||||||
*
|
*
|
||||||
* // set handlers
|
* // set flip enabled property
|
||||||
* transformer.flipEnabled(false);
|
* transformer.flipEnabled(false);
|
||||||
*/
|
*/
|
||||||
Factory.addGetterSetter(Transformer, 'flipEnabled', true, getBooleanValidator());
|
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",
|
"name": "konva",
|
||||||
"version": "7.2.5",
|
"version": "8.0.0-0",
|
||||||
"author": "Anton Lavrenov",
|
"author": "Anton Lavrenov",
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
|
@ -18,11 +18,10 @@ files.then((filePaths) => {
|
|||||||
|
|
||||||
// stupid replacement back
|
// stupid replacement back
|
||||||
text = text.replace(
|
text = text.replace(
|
||||||
"import * as canvas from 'canvas.js';",
|
"import * as Canvas from 'canvas.js';",
|
||||||
"import * as canvas from 'canvas';"
|
"import * as Canvas from 'canvas';"
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(`writing to ${filepath}`);
|
|
||||||
fs.writeFile(filepath, text, function (err) {
|
fs.writeFile(filepath, text, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -803,13 +803,13 @@ export const Util = {
|
|||||||
Util.warn(
|
Util.warn(
|
||||||
'Util._degToRad is removed. Please use public Util.degToRad instead.'
|
'Util._degToRad is removed. Please use public Util.degToRad instead.'
|
||||||
);
|
);
|
||||||
return Util._degToRad(deg);
|
return Util.degToRad(deg);
|
||||||
},
|
},
|
||||||
_radToDeg(rad: number) {
|
_radToDeg(rad: number) {
|
||||||
Util.warn(
|
Util.warn(
|
||||||
'Util._radToDeg is removed. Please use public Util.radToDeg instead.'
|
'Util._radToDeg is removed. Please use public Util.radToDeg instead.'
|
||||||
);
|
);
|
||||||
return Util._radToDeg(rad);
|
return Util.radToDeg(rad);
|
||||||
},
|
},
|
||||||
_getRotation(radians) {
|
_getRotation(radians) {
|
||||||
return Konva.angleDeg ? Util.radToDeg(radians) : radians;
|
return Konva.angleDeg ? Util.radToDeg(radians) : radians;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// main entry for umd build for rollup
|
// main entry for umd build for rollup
|
||||||
import { Konva } from './_FullInternals';
|
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';
|
const isNode = typeof global.document === 'undefined';
|
||||||
|
|
||||||
|
@ -1279,7 +1279,7 @@ Factory.addGetterSetter(
|
|||||||
* // get flip enabled property
|
* // get flip enabled property
|
||||||
* var flipEnabled = transformer.flipEnabled();
|
* var flipEnabled = transformer.flipEnabled();
|
||||||
*
|
*
|
||||||
* // set handlers
|
* // set flip enabled property
|
||||||
* transformer.flipEnabled(false);
|
* transformer.flipEnabled(false);
|
||||||
*/
|
*/
|
||||||
Factory.addGetterSetter(
|
Factory.addGetterSetter(
|
||||||
|
@ -22,4 +22,6 @@ equal(Konva2.Rect, Rect, 'Rect is injected');
|
|||||||
|
|
||||||
equal(Konva2, Konva, 'Same Konva');
|
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