konva 10.3.1 → 10.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,15 +7,15 @@
7
7
  <p align="center"><strong>Build interactive graphics, editors, and diagrams for the web.</strong></p>
8
8
 
9
9
  [![npm downloads](https://img.shields.io/npm/dw/konva.svg)](https://www.npmjs.com/package/konva)
10
- [![npm version](https://badge.fury.io/js/konva.svg)](http://badge.fury.io/js/konva)
10
+ [![npm version](https://badge.fury.io/js/konva.svg)](https://badge.fury.io/js/konva)
11
11
  [![Financial Contributors on Open Collective](https://opencollective.com/konva/all/badge.svg?label=financial+contributors)](https://opencollective.com/konva)
12
12
  [![Build Status](https://github.com/konvajs/konva/actions/workflows/test-browser.yml/badge.svg)](https://github.com/konvajs/konva/actions/workflows/test-browser.yml)
13
13
  [![Build Status](https://github.com/konvajs/konva/actions/workflows/test-node.yml/badge.svg)](https://github.com/konvajs/konva/actions/workflows/test-node.yml)
14
14
  [![CDNJS version](https://img.shields.io/cdnjs/v/konva.svg)](https://cdnjs.com/libraries/konva)
15
15
 
16
- Konva is an HTML5 Canvas JavaScript framework that enables high performance animations, transitions, node nesting, layering, filtering, caching, event handling for desktop and mobile applications, and much more.
16
+ Konva is an open-source 2D canvas framework for interactive graphics. Its scene graph gives each shape its own events, drag behavior, transforms, animation, cache, and export controls.
17
17
 
18
- You can draw things onto the stage, add event listeners to them, move them, scale them, and rotate them independently from other shapes to support high performance animations, even if your application uses thousands of shapes. Served hot with a side of awesomeness.
18
+ Use Konva for design editors, whiteboards, diagrams, annotations, maps, and other visual tools. Konva is MIT licensed and does not require a license key.
19
19
 
20
20
  This repository began as a GitHub fork of [ericdrowell/KineticJS](https://github.com/ericdrowell/KineticJS).
21
21
 
@@ -24,51 +24,41 @@ This repository began as a GitHub fork of [ericdrowell/KineticJS](https://github
24
24
  - **Try it:** [Canvas Editor](https://konvajs.org/docs/sandbox/Canvas_Editor.html), [Free Drawing](https://konvajs.org/docs/sandbox/Free_Drawing.html), [Image Crop](https://konvajs.org/docs/sandbox/Canvas_Crop_Image.html), [Window Frame Designer](https://konvajs.org/docs/sandbox/Window_Frame_Designer.html), and [more demos](https://konvajs.org/docs/sandbox.html)
25
25
  - **Used by:** [Polotno](https://polotno.com/?utm_source=konvajs) (design editor SDK) and many others — see the full showcase on the [home page](https://konvajs.org/)
26
26
  - **Help:** [StackOverflow](https://stackoverflow.com/questions/tagged/konvajs), [Discord Chat](https://discord.gg/8FqZwVT)
27
+ - **Support the project:** [Star Konva on GitHub](https://github.com/konvajs/konva)
28
+
29
+ [![A Konva Transformer around a selected image](https://konvajs.org/assets/demos/image-resize-min.png)](https://konvajs.org/docs/select_and_transform/Basic_demo.html)
30
+
31
+ ## Framework integrations
32
+
33
+ | Framework | Package | Documentation |
34
+ |---|---|---|
35
+ | React | [`react-konva`](https://www.npmjs.com/package/react-konva) | [React guide](https://konvajs.org/docs/react/index.html) |
36
+ | Vue | [`vue-konva`](https://www.npmjs.com/package/vue-konva) | [Vue guide](https://konvajs.org/docs/vue/index.html) |
37
+ | Svelte | [`svelte-konva`](https://www.npmjs.com/package/svelte-konva) | [Svelte guide](https://konvajs.org/docs/svelte/index.html) |
38
+ | Angular | [`ng2-konva`](https://www.npmjs.com/package/ng2-konva) | [Angular guide](https://konvajs.org/docs/angular/index.html) |
27
39
 
28
40
  # Quick Look
29
41
 
30
- ```html
31
- <script src="https://unpkg.com/konva@10.0.0-1/konva.min.js"></script>
32
- <div id="container"></div>
33
- <script>
34
- var stage = new Konva.Stage({
35
- container: 'container',
36
- width: window.innerWidth,
37
- height: window.innerHeight,
38
- });
39
-
40
- // add canvas element
41
- var layer = new Konva.Layer();
42
- stage.add(layer);
43
-
44
- // create shape
45
- var box = new Konva.Rect({
46
- x: 50,
47
- y: 50,
48
- width: 100,
49
- height: 50,
50
- fill: '#00D2FF',
51
- stroke: 'black',
52
- strokeWidth: 4,
53
- draggable: true,
54
- });
55
- layer.add(box);
56
-
57
- // add cursor styling
58
- box.on('mouseover', function () {
59
- document.body.style.cursor = 'pointer';
60
- });
61
- box.on('mouseout', function () {
62
- document.body.style.cursor = 'default';
63
- });
64
- </script>
42
+ ```javascript
43
+ import Konva from 'konva';
44
+
45
+ const container = document.createElement('div');
46
+ document.body.appendChild(container);
47
+
48
+ const stage = new Konva.Stage({ container, width: 600, height: 400 });
49
+ const layer = new Konva.Layer();
50
+ const box = new Konva.Rect({
51
+ x: 50, y: 50, width: 120, height: 80,
52
+ fill: '#00a8e8', draggable: true,
53
+ });
54
+
55
+ layer.add(box);
56
+ stage.add(layer);
65
57
  ```
66
58
 
67
59
  # Browsers support
68
60
 
69
- Konva works in all modern mobile and desktop browsers. A browser need to be capable to run javascript code from ES2015 spec. For older browsers you may need polyfills for missing functions.
70
-
71
- At the current moment `Konva` doesn't work in IE11 directly. To make it work you just need to provide some polyfills such as `Array.prototype.find`, `String.prototype.trimLeft`, `String.prototype.trimRight`, `Array.from`.
61
+ Konva works in modern mobile and desktop browsers that support ES2015.
72
62
 
73
63
  # Debugging
74
64
 
@@ -81,13 +71,13 @@ Konva supports UMD loading. So you can use all possible variants to load the fra
81
71
  ### Load Konva via classical `<script>` tag from CDN:
82
72
 
83
73
  ```html
84
- <script src="https://unpkg.com/konva@10.0.0-1/konva.min.js"></script>
74
+ <script src="https://unpkg.com/konva@10/konva.min.js"></script>
85
75
  ```
86
76
 
87
77
  ### Install with npm:
88
78
 
89
79
  ```bash
90
- npm install konva --save
80
+ npm install konva
91
81
  ```
92
82
 
93
83
  ```javascript