mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 21:34:50 +08:00
update CHANGELOG with new version
This commit is contained in:
@@ -662,14 +662,20 @@ export class Transformer extends Group {
|
||||
stage.setPointersPositions(e);
|
||||
|
||||
const pp = stage.getPointerPosition();
|
||||
var newNodePos = {
|
||||
let newNodePos = {
|
||||
x: pp.x - this._anchorDragOffset.x,
|
||||
y: pp.y - this._anchorDragOffset.y,
|
||||
};
|
||||
const oldAbs = anchorNode.getAbsolutePosition();
|
||||
|
||||
if (this.anchorDragBoundFunc()) {
|
||||
newNodePos = this.anchorDragBoundFunc()(oldAbs, newNodePos, e);
|
||||
}
|
||||
anchorNode.setAbsolutePosition(newNodePos);
|
||||
const newAbs = anchorNode.getAbsolutePosition();
|
||||
|
||||
// console.log(oldAbs, newNodePos, newAbs);
|
||||
|
||||
if (oldAbs.x === newAbs.x && oldAbs.y === newAbs.y) {
|
||||
return;
|
||||
}
|
||||
@@ -1235,6 +1241,10 @@ export class Transformer extends Group {
|
||||
flipEnabled: GetSet<boolean, this>;
|
||||
ignoreStroke: GetSet<boolean, this>;
|
||||
boundBoxFunc: GetSet<(oldBox: Box, newBox: Box) => Box, this>;
|
||||
anchorDragBoundFunc: GetSet<
|
||||
(oldPos: Vector2d, newPos: Vector2d, e: MouseEvent) => Box,
|
||||
this
|
||||
>;
|
||||
shouldOverdrawWholeArea: GetSet<boolean, this>;
|
||||
useSingleNodeRotation: GetSet<boolean, this>;
|
||||
}
|
||||
@@ -1641,6 +1651,26 @@ Factory.addGetterSetter(Transformer, 'nodes');
|
||||
*/
|
||||
Factory.addGetterSetter(Transformer, 'boundBoxFunc');
|
||||
|
||||
/**
|
||||
* get/set dragging func for transformer anchors
|
||||
* @name Konva.Transformer#anchorDragBoundFunc
|
||||
* @method
|
||||
* @param {Function} func
|
||||
* @returns {Function}
|
||||
* @example
|
||||
* // get
|
||||
* var anchorDragBoundFunc = transformer.anchorDragBoundFunc();
|
||||
*
|
||||
* // set
|
||||
* transformer.anchorDragBoundFunc(function(oldAbsPos, newAbsPos, event) {
|
||||
* return {
|
||||
* x: 0,
|
||||
* y: newAbsolutePosition.y
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
Factory.addGetterSetter(Transformer, 'anchorDragBoundFunc');
|
||||
|
||||
/**
|
||||
* using this setting you can drag transformer group by dragging empty space between attached nodes
|
||||
* shouldOverdrawWholeArea = true may temporary disable all events on attached nodes
|
||||
|
||||
Reference in New Issue
Block a user