|
@@ -105,6 +105,16 @@ export function getResizeHandlerFromCoords(
|
|
|
return (found || false) as HandlerRectanglesRet;
|
|
|
}
|
|
|
|
|
|
+const RESIZE_CURSORS = ["ns", "nesw", "ew", "nwse"];
|
|
|
+const rotateResizeCursor = (cursor: string, angle: number) => {
|
|
|
+ const index = RESIZE_CURSORS.indexOf(cursor);
|
|
|
+ if (index >= 0) {
|
|
|
+ const a = Math.round(angle / (Math.PI / 4));
|
|
|
+ cursor = RESIZE_CURSORS[(index + a) % RESIZE_CURSORS.length];
|
|
|
+ }
|
|
|
+ return cursor;
|
|
|
+};
|
|
|
+
|
|
|
/*
|
|
|
* Returns bi-directional cursor for the element being resized
|
|
|
*/
|
|
@@ -143,8 +153,11 @@ export function getCursorForResizingElement(resizingElement: {
|
|
|
}
|
|
|
break;
|
|
|
case "rotation":
|
|
|
- cursor = "ew";
|
|
|
- break;
|
|
|
+ return "grab";
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cursor && element) {
|
|
|
+ cursor = rotateResizeCursor(cursor, element.angle);
|
|
|
}
|
|
|
|
|
|
return cursor ? `${cursor}-resize` : "";
|