Yes, you can move the rectangle left or right by setting the left and right properties of the this.rect object. Here's an example:

To move the rectangle to the left:

this.rect.position({ x: this.rect.x() - distanceToMove, y: this.rect.y() });

To move the rectangle to the right:

this.rect.position({ x: this.rect.x() + distanceToMove, y: this.rect.y() });

Make sure to replace distanceToMove with the desired distance value.

thisrect = new KonvaRect x 0 y 0 width wh height wh fill flag == this$toperateMaplaserTitle5s9vllu6i400 transparent white stroke red visible false

原文地址: https://www.cveoy.top/t/topic/jeo8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录