mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
Fix transformer rotation when parent of a node is rotated too
This commit is contained in:
@@ -28,9 +28,9 @@ export interface ContainerConfig extends NodeConfig {
|
||||
* @@nodeParams
|
||||
* @@containerParams
|
||||
*/
|
||||
export abstract class Container<ChildType extends Node> extends Node<
|
||||
ContainerConfig
|
||||
> {
|
||||
export abstract class Container<
|
||||
ChildType extends Node
|
||||
> extends Node<ContainerConfig> {
|
||||
children = new Collection<ChildType>();
|
||||
|
||||
/**
|
||||
@@ -154,7 +154,7 @@ export abstract class Container<ChildType extends Node> extends Node<
|
||||
* You can provide a string with '#' for id selections and '.' for name selections.
|
||||
* Or a function that will return true/false when a node is passed through. See example below.
|
||||
* With strings you can also select by type or class name. Pass multiple selectors
|
||||
* separated by a space.
|
||||
* separated by a comma.
|
||||
* @method
|
||||
* @name Konva.Container#find
|
||||
* @param {String | Function} selector
|
||||
|
@@ -2809,7 +2809,7 @@ addGetterSetter(Node, 'opacity', 1, getNumberValidator());
|
||||
addGetterSetter(Node, 'name', '', getStringValidator());
|
||||
|
||||
/**
|
||||
* get/set name
|
||||
* get/set name.
|
||||
* @name Konva.Node#name
|
||||
* @method
|
||||
* @param {String} name
|
||||
|
@@ -283,7 +283,7 @@ export class Transformer extends Group {
|
||||
}
|
||||
this._nodes = nodes;
|
||||
if (nodes.length === 1) {
|
||||
this.rotation(nodes[0].rotation());
|
||||
this.rotation(nodes[0].getAbsoluteRotation());
|
||||
} else {
|
||||
this.rotation(0);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ export class Transformer extends Group {
|
||||
const onChange = () => {
|
||||
//
|
||||
if (this.nodes().length === 1) {
|
||||
this.rotation(this.nodes()[0].rotation());
|
||||
this.rotation(this.nodes()[0].getAbsoluteRotation());
|
||||
}
|
||||
|
||||
this._resetTransformCache();
|
||||
@@ -524,7 +524,7 @@ export class Transformer extends Group {
|
||||
name: name + ' _anchor',
|
||||
dragDistance: 0,
|
||||
// make it draggable,
|
||||
// so activating the anchror will not start drag&drop of any parent
|
||||
// so activating the anchor will not start drag&drop of any parent
|
||||
draggable: true,
|
||||
hitStrokeWidth: TOUCH_DEVICE ? 10 : 'auto',
|
||||
});
|
||||
|
Reference in New Issue
Block a user