Update rectangle.tsx
This commit is contained in:
parent
3310f1a94c
commit
2a28064a68
1 changed files with 6 additions and 6 deletions
|
@ -95,9 +95,14 @@ const rectangle = registerShapeUtils<RectangleShape>({
|
||||||
|
|
||||||
transform(shape, bounds, { initialShape, transformOrigin, scaleX, scaleY }) {
|
transform(shape, bounds, { initialShape, transformOrigin, scaleX, scaleY }) {
|
||||||
if (shape.rotation === 0) {
|
if (shape.rotation === 0) {
|
||||||
shape.point = [bounds.minX, bounds.minY]
|
|
||||||
shape.size = [bounds.width, bounds.height]
|
shape.size = [bounds.width, bounds.height]
|
||||||
|
shape.point = [bounds.minX, bounds.minY]
|
||||||
} else {
|
} else {
|
||||||
|
shape.size = vec.mul(
|
||||||
|
initialShape.size,
|
||||||
|
Math.min(Math.abs(scaleX), Math.abs(scaleY))
|
||||||
|
)
|
||||||
|
|
||||||
shape.point = [
|
shape.point = [
|
||||||
bounds.minX +
|
bounds.minX +
|
||||||
(bounds.width - shape.size[0]) *
|
(bounds.width - shape.size[0]) *
|
||||||
|
@ -107,11 +112,6 @@ const rectangle = registerShapeUtils<RectangleShape>({
|
||||||
(scaleY < 0 ? 1 - transformOrigin[1] : transformOrigin[1]),
|
(scaleY < 0 ? 1 - transformOrigin[1] : transformOrigin[1]),
|
||||||
]
|
]
|
||||||
|
|
||||||
shape.size = vec.mul(
|
|
||||||
initialShape.size,
|
|
||||||
Math.min(Math.abs(scaleX), Math.abs(scaleY))
|
|
||||||
)
|
|
||||||
|
|
||||||
shape.rotation =
|
shape.rotation =
|
||||||
(scaleX < 0 && scaleY >= 0) || (scaleY < 0 && scaleX >= 0)
|
(scaleX < 0 && scaleY >= 0) || (scaleY < 0 && scaleX >= 0)
|
||||||
? -initialShape.rotation
|
? -initialShape.rotation
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue