update rotation of transformer automatically. close #976

This commit is contained in:
Anton Lavrenov
2020-09-07 10:40:23 -05:00
parent f88d539c12
commit 40d68ea6e8
6 changed files with 71 additions and 5 deletions

View File

@@ -665,7 +665,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
* @method
* @name Konva.Node#on
* @param {String} evtStr e.g. 'click', 'mousedown touchstart', 'mousedown.foo touchstart.foo'
* @param {Function} handler The handler function is passed an event object
* @param {Function} handler The handler function. The first argument of that function is event object. Event object has `target` as main target of the event, `currentTarget` as current node listener and `evt` as native browser event.
* @returns {Konva.Node}
* @example
* // add click listener

View File

@@ -292,6 +292,11 @@ export class Transformer extends Group {
.join(' ');
const onChange = () => {
//
if (this.nodes().length === 1) {
this.rotation(this.nodes()[0].rotation());
}
this._resetTransformCache();
if (!this._transforming) {
this.update();