|
@@ -144,7 +144,7 @@ export function resizeElements(
|
|
|
width,
|
|
|
height,
|
|
|
...adjustXYWithRotation("nw", element, deltaX, dY, angle),
|
|
|
- ...(isLinearElement(element) && width >= 0 && height >= 0
|
|
|
+ ...(isLinearElement(element) && width !== 0 && height !== 0
|
|
|
? {
|
|
|
points: rescalePoints(
|
|
|
0,
|
|
@@ -176,7 +176,7 @@ export function resizeElements(
|
|
|
width,
|
|
|
height,
|
|
|
...adjustXYWithRotation("ne", element, deltaX, dY, angle),
|
|
|
- ...(isLinearElement(element) && width >= 0 && height >= 0
|
|
|
+ ...(isLinearElement(element) && width !== 0 && height !== 0
|
|
|
? {
|
|
|
points: rescalePoints(
|
|
|
0,
|
|
@@ -208,7 +208,7 @@ export function resizeElements(
|
|
|
width,
|
|
|
height,
|
|
|
...adjustXYWithRotation("sw", element, deltaX, dY, angle),
|
|
|
- ...(isLinearElement(element) && width >= 0 && height >= 0
|
|
|
+ ...(isLinearElement(element) && width !== 0 && height !== 0
|
|
|
? {
|
|
|
points: rescalePoints(
|
|
|
0,
|
|
@@ -240,7 +240,7 @@ export function resizeElements(
|
|
|
width,
|
|
|
height,
|
|
|
...adjustXYWithRotation("se", element, deltaX, dY, angle),
|
|
|
- ...(isLinearElement(element) && width >= 0 && height >= 0
|
|
|
+ ...(isLinearElement(element) && width !== 0 && height !== 0
|
|
|
? {
|
|
|
points: rescalePoints(
|
|
|
0,
|
|
@@ -255,12 +255,7 @@ export function resizeElements(
|
|
|
case "n": {
|
|
|
const height = element.height - deltaY;
|
|
|
|
|
|
- if (isLinearElement(element)) {
|
|
|
- if (element.points.length > 2 && height <= 0) {
|
|
|
- // Someday we should implement logic to flip the shape.
|
|
|
- // But for now, just stop.
|
|
|
- break;
|
|
|
- }
|
|
|
+ if (isLinearElement(element) && height !== 0) {
|
|
|
mutateElement(element, {
|
|
|
height,
|
|
|
...adjustXYWithRotation("n", element, 0, deltaY, angle),
|
|
@@ -278,13 +273,7 @@ export function resizeElements(
|
|
|
case "w": {
|
|
|
const width = element.width - deltaX;
|
|
|
|
|
|
- if (isLinearElement(element)) {
|
|
|
- if (element.points.length > 2 && width <= 0) {
|
|
|
- // Someday we should implement logic to flip the shape.
|
|
|
- // But for now, just stop.
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
+ if (isLinearElement(element) && width !== 0) {
|
|
|
mutateElement(element, {
|
|
|
width,
|
|
|
...adjustXYWithRotation("w", element, deltaX, 0, angle),
|
|
@@ -301,12 +290,7 @@ export function resizeElements(
|
|
|
case "s": {
|
|
|
const height = element.height + deltaY;
|
|
|
|
|
|
- if (isLinearElement(element)) {
|
|
|
- if (element.points.length > 2 && height <= 0) {
|
|
|
- // Someday we should implement logic to flip the shape.
|
|
|
- // But for now, just stop.
|
|
|
- break;
|
|
|
- }
|
|
|
+ if (isLinearElement(element) && height !== 0) {
|
|
|
mutateElement(element, {
|
|
|
height,
|
|
|
...adjustXYWithRotation("s", element, 0, deltaY, angle),
|
|
@@ -323,12 +307,7 @@ export function resizeElements(
|
|
|
case "e": {
|
|
|
const width = element.width + deltaX;
|
|
|
|
|
|
- if (isLinearElement(element)) {
|
|
|
- if (element.points.length > 2 && width <= 0) {
|
|
|
- // Someday we should implement logic to flip the shape.
|
|
|
- // But for now, just stop.
|
|
|
- break;
|
|
|
- }
|
|
|
+ if (isLinearElement(element) && width !== 0) {
|
|
|
mutateElement(element, {
|
|
|
width,
|
|
|
...adjustXYWithRotation("e", element, deltaX, 0, angle),
|