给上一章做一个补充,就是实现通过上下左右按键移动所选节点。
继续求 Star ,希望大家多多一键三连,十分感谢大家的支持~
创作不易,Star 50 个,创作加速!
通过按键移动节点
准备工作
给 SelectionTool 添加两个必要的方法:
// 更新已选位置
selectingNodesAreaMove(offset: Konva.Vector2d) {
this.selectingNodesArea?.x(this.selectingNodesArea.x() + offset.x)
this.selectingNodesArea?.y(this.selectingNodesArea.y() + offset.y)
}
// 更新节点位置
selectingNodesMove(offset: Konva.Vector2d) {
for (const node of this.render.selectionTool.selectingNodes<