Add resizable mobile friendly crop selection
This commit is contained in:
@@ -145,8 +145,17 @@ input[type="range"] { accent-color: var(--green); }
|
||||
.crop-dialog-header h2 { margin: 0; font-size: 22px; }
|
||||
.crop-dialog-header p:not(.section-kicker) { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
|
||||
.crop-dialog-header > button { width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid var(--line); background: white; cursor: pointer; font-size: 25px; line-height: 1; }
|
||||
.crop-mode-bar { min-height: 54px; padding: 8px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: #f7f4ec; color: var(--muted); font-size: 11px; }
|
||||
.crop-mode-switch { display: inline-flex; border: 1px solid var(--ink); background: white; }
|
||||
.crop-mode-switch button { min-height: 34px; padding: 0 15px; border: 0; border-right: 1px solid var(--ink); background: transparent; cursor: pointer; font-size: 12px; }
|
||||
.crop-mode-switch button:last-child { border-right: 0; }
|
||||
.crop-mode-switch button.active { background: var(--green); color: white; font-weight: 700; }
|
||||
.crop-size-readout { margin-left: auto; font-variant-numeric: tabular-nums; }
|
||||
.crop-dialog-scroll { min-height: 0; flex: 1 1 auto; overflow: auto; padding: 18px; display: grid; place-items: center; background-color: #e9e5db; background-image: radial-gradient(#c8c3b8 .7px, transparent .7px); background-size: 12px 12px; }
|
||||
.crop-dialog-stage { position: relative; width: max-content; max-width: 100%; line-height: 0; cursor: crosshair; touch-action: none; user-select: none; box-shadow: 0 0 0 1px var(--ink); }
|
||||
.crop-dialog-stage.can-move-selection { cursor: move; }
|
||||
.crop-dialog-stage.is-moving-selection { cursor: grabbing; }
|
||||
.crop-dialog-stage.is-resizing-selection { cursor: nwse-resize; }
|
||||
.crop-dialog-stage canvas { display: block; max-width: 100%; height: auto; pointer-events: none; }
|
||||
.crop-selection-mask { position: absolute; z-index: 1; background: rgba(10,15,13,.55); pointer-events: none; }
|
||||
.crop-selection-top { inset: 0 0 auto; }
|
||||
@@ -156,6 +165,15 @@ input[type="range"] { accent-color: var(--green); }
|
||||
.crop-selection-box::before, .crop-selection-box::after { content: ""; position: absolute; background: rgba(255,255,255,.62); }
|
||||
.crop-selection-box::before { left: 33.333%; top: 0; bottom: 0; width: 1px; box-shadow: calc(33.333% * 1) 0 0 rgba(255,255,255,.62); }
|
||||
.crop-selection-box::after { left: 0; right: 0; top: 33.333%; height: 1px; box-shadow: 0 calc(33.333% * 1) 0 rgba(255,255,255,.62); }
|
||||
.crop-resize-handle { position: absolute; z-index: 4; width: 15px; height: 15px; display: block; border: 2px solid white; border-radius: 50%; background: var(--green); box-shadow: 0 1px 4px rgba(0,0,0,.48); pointer-events: auto; }
|
||||
.handle-nw { left: 0; top: 0; transform: translate(-50%, -50%); cursor: nwse-resize; }
|
||||
.handle-ne { right: 0; top: 0; transform: translate(50%, -50%); cursor: nesw-resize; }
|
||||
.handle-sw { left: 0; bottom: 0; transform: translate(-50%, 50%); cursor: nesw-resize; }
|
||||
.handle-se { right: 0; bottom: 0; transform: translate(50%, 50%); cursor: nwse-resize; }
|
||||
.handle-n { left: 50%; top: 0; transform: translate(-50%, -50%); cursor: ns-resize; }
|
||||
.handle-s { left: 50%; bottom: 0; transform: translate(-50%, 50%); cursor: ns-resize; }
|
||||
.handle-w { left: 0; top: 50%; transform: translate(-50%, -50%); cursor: ew-resize; }
|
||||
.handle-e { right: 0; top: 50%; transform: translate(50%, -50%); cursor: ew-resize; }
|
||||
.crop-dialog-actions { flex: 0 0 auto; min-height: 66px; padding: 12px 20px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
|
||||
.crop-dialog-actions span { margin-right: auto; color: var(--muted); font-size: 11px; }
|
||||
.crop-dialog-actions button { min-height: 40px; padding: 0 16px; border: 1px solid var(--ink); background: white; cursor: pointer; font-size: 12px; }
|
||||
@@ -201,6 +219,12 @@ input[type="range"] { accent-color: var(--green); }
|
||||
.crop-dialog { width: 100vw; max-height: 100vh; height: 100vh; border: 0; box-shadow: none; }
|
||||
.crop-dialog-header { padding: 14px 16px; }
|
||||
.crop-dialog-header h2 { font-size: 18px; }
|
||||
.crop-mode-bar { padding: 8px 12px; flex-wrap: wrap; gap: 7px 10px; }
|
||||
.crop-mode-switch { flex: 1; }
|
||||
.crop-mode-switch button { flex: 1; padding: 0 8px; }
|
||||
.crop-size-readout { width: 100%; margin-left: 0; }
|
||||
.crop-resize-handle { width: 28px; height: 28px; border-width: 3px; }
|
||||
.crop-edge-handle { display: none; }
|
||||
.crop-dialog-scroll { padding: 10px; }
|
||||
.crop-dialog-actions { padding: 10px 12px; flex-wrap: wrap; }
|
||||
.crop-dialog-actions span { width: 100%; order: -1; }
|
||||
|
||||
Reference in New Issue
Block a user