From 8c27e163144a0013beaf1089779a4c16252e4b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cchrisshank=E2=80=9D?= Date: Sat, 7 Dec 2024 14:34:06 -0800 Subject: [PATCH] cursor simplification --- src/folk-shape.ts | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/folk-shape.ts b/src/folk-shape.ts index 28940e8..c28c617 100644 --- a/src/folk-shape.ts +++ b/src/folk-shape.ts @@ -85,10 +85,7 @@ const styles = css` user-select: none; } - [part='resize-top-left'], - [part='resize-top-right'], - [part='resize-bottom-right'], - [part='resize-bottom-left'] { + [part^='resize'] { display: block; position: absolute; box-sizing: border-box; @@ -122,16 +119,6 @@ const styles = css` left: 0; } - [part='resize-top-left'], - [part='resize-bottom-right'] { - cursor: var(--resize-handle-cursor-nw); - } - - [part='resize-top-right'], - [part='resize-bottom-left'] { - cursor: var(--resize-handle-cursor-ne); - } - [part^='rotation'] { z-index: calc(infinity); display: block; @@ -142,7 +129,6 @@ const styles = css` opacity: 0; width: 16px; aspect-ratio: 1; - cursor: var(--fc-rotate, url('${getRotateCursorUrl(0)}') 16 16, pointer); } [part='rotation-top-left'] { @@ -171,8 +157,7 @@ const styles = css` :host(:not(:focus-within)) [part^='resize'], :host(:not(:focus-within)) [part^='rotation'] { - opacity: 0; - cursor: default; + display: none; } `; @@ -299,6 +284,8 @@ export class FolkShape extends HTMLElement { ]) ) as Record; + this.#updateCursors(); + this.x = Number(this.getAttribute('x')) || 0; this.y = Number(this.getAttribute('y')) || 0; this.width = Number(this.getAttribute('width')) || 'auto';