diff --git a/README.md b/README.md index f8fd60f..f523f1e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ultra launcher -An Android home screen written as an [ultra](https://github.com/nandi-conda/ultra) app (LPython compiled to WebAssembly, Elm-style). The home starts blank with a clock: long-press it to add apps (the drawer opens in a pick mode) or widgets, and long-press anything on it to move or remove it. Swipe down for the drawer with every app and a search (Enter opens the first match); long-press an app there to put it on the home screen, and swipe up to close it. The panel under the clock has a **Windows** button that opens Recents. The layout is saved in localStorage. +An Android home screen written as an [ultra](https://github.com/nandi-conda/ultra) app (LPython compiled to WebAssembly, Elm-style). The home starts blank with a clock: long-press it to add apps (the drawer opens in a pick mode) or widgets, and long-press anything on it to drag it somewhere else; let go without moving to get its menu, or, for a widget, handles on its edges that resize it to the grid. Swipe down for the drawer with every app and a search (Enter opens the first match); long-press an app there to put it on the home screen, and swipe up to close it. The panel under the clock has a **Windows** button that opens Recents. The layout is saved in localStorage. ## Install diff --git a/android/app/src/main/java/dev/ultra/launcher/MainActivity.java b/android/app/src/main/java/dev/ultra/launcher/MainActivity.java index 3b90a7f..1006bb0 100644 --- a/android/app/src/main/java/dev/ultra/launcher/MainActivity.java +++ b/android/app/src/main/java/dev/ultra/launcher/MainActivity.java @@ -16,6 +16,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Insets; +import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; @@ -28,6 +29,7 @@ import android.provider.Settings; import android.text.format.DateFormat; import android.util.Base64; import android.util.Log; +import android.util.SizeF; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.View; @@ -73,7 +75,8 @@ import java.util.concurrent.Executors; * wicon?p=PROV the provider's icon as a PNG * * and exposes window.Android (launch, appInfo, addWidget, removeWidget, placeWidgets, - * openSettings, pickWallpaper, openRecents, haptic, is24Hour) for the app's @jscall imports. + * widgetLimits, excludeGestures, openSettings, pickWallpaper, openRecents, haptic, is24Hour) + * for the app's @jscall imports and index.html. * * Widgets are real AppWidgetHostViews in a layer above the WebView. The page reports where * its live widget slots are (placeWidgets), and this class moves the views there. Package @@ -93,6 +96,7 @@ public class MainActivity extends Activity { private AppWidgetManager widgets; private AppWidgetHost widgetHost; private final Map widgetViews = new HashMap<>(); + private final Map widgetSizes = new HashMap<>(); // last size told to each widget private int pendingWidget = -1; private boolean ready; private int insetTop, insetBottom; // CSS px @@ -163,6 +167,7 @@ public class MainActivity extends Activity { return insets; }); widgetViews.clear(); + widgetSizes.clear(); widgetLayer = new FrameLayout(this); FrameLayout root = new FrameLayout(this); root.addView(web); @@ -473,9 +478,56 @@ public class MainActivity extends Activity { private void removeWidget(int id) { AppWidgetHostView v = widgetViews.remove(id); if (v != null) widgetLayer.removeView(v); + widgetSizes.remove(id); widgetHost.deleteAppWidgetId(id); } + /** + * How far a placed widget may be resized, in CSS px: {"minW", "minH", "maxW", "maxH" + * (0 = no limit), "h", "v" (whether it resizes horizontally / vertically)}. + */ + private String widgetLimits(int id) { + AppWidgetProviderInfo w = widgets.getAppWidgetInfo(id); + JSONObject o = new JSONObject(); + try { + if (w == null) return o.toString(); + float d = getResources().getDisplayMetrics().density; + // A minResize larger than the min size (or unset) means the min size applies. + int minW = w.minResizeWidth > 0 && w.minResizeWidth < w.minWidth ? w.minResizeWidth : w.minWidth; + int minH = w.minResizeHeight > 0 && w.minResizeHeight < w.minHeight ? w.minResizeHeight : w.minHeight; + int maxW = 0, maxH = 0; + if (Build.VERSION.SDK_INT >= 31) { + maxW = w.maxResizeWidth; + maxH = w.maxResizeHeight; + } + o.put("minW", Math.round(minW / d)).put("minH", Math.round(minH / d)) + .put("maxW", Math.round(maxW / d)).put("maxH", Math.round(maxH / d)) + .put("h", (w.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0) + .put("v", (w.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0); + } catch (JSONException e) { + Log.w("ultra", "widget limits", e); + } + return o.toString(); + } + + /** Keep the system's edge gestures off these page rects ([[x, y, w, h], ...] in CSS px). */ + private void excludeGestures(String json) { + if (Build.VERSION.SDK_INT < 29) return; + float d = getResources().getDisplayMetrics().density; + List rects = new ArrayList<>(); + try { + JSONArray a = new JSONArray(json); + for (int i = 0; i < a.length(); i++) { + JSONArray r = a.getJSONArray(i); + int x = Math.round(r.getInt(0) * d), y = Math.round(r.getInt(1) * d); + rects.add(new Rect(x, y, x + Math.round(r.getInt(2) * d), y + Math.round(r.getInt(3) * d))); + } + } catch (JSONException e) { + return; + } + web.setSystemGestureExclusionRects(rects); + } + /** Lay widget views over the page's live slots: [[id, x, y, w, h], ...] in CSS px. */ private void placeWidgets(String json) { float d = getResources().getDisplayMetrics().density; @@ -511,7 +563,18 @@ public class MainActivity extends Activity { lp.topMargin = r[1]; v.setLayoutParams(lp); v.setVisibility(View.VISIBLE); - v.updateAppWidgetSize(new Bundle(), r[4], r[5], r[4], r[5]); + // Scrolling moves a widget without resizing it; only tell it about new sizes. + long size = ((long) r[4] << 32) | r[5]; + Long was = widgetSizes.put(id, size); + if (was == null || was != size) { + if (Build.VERSION.SDK_INT >= 31) { + List sizes = new ArrayList<>(); + sizes.add(new SizeF(r[4], r[5])); + v.updateAppWidgetSize(new Bundle(), sizes); + } else { + v.updateAppWidgetSize(new Bundle(), r[4], r[5], r[4], r[5]); + } + } } } @@ -678,6 +741,14 @@ public class MainActivity extends Activity { main.post(() -> MainActivity.this.placeWidgets(json)); } + @JavascriptInterface public String widgetLimits(int id) { + return MainActivity.this.widgetLimits(id); + } + + @JavascriptInterface public void excludeGestures(String json) { + main.post(() -> MainActivity.this.excludeGestures(json)); + } + @JavascriptInterface public void loadIcons(String keys) { MainActivity.this.loadIcons(keys); } diff --git a/tests/e2e.cjs b/tests/e2e.cjs index 24b00f3..09dce0c 100644 --- a/tests/e2e.cjs +++ b/tests/e2e.cjs @@ -94,8 +94,29 @@ const BASE = process.env.BASE || "http://localhost:8000"; assert.equal(await p.$$eval(".slots > li", (ls) => ls.length), 5); await p.click(".slots .tile:first-child"); await settle(); assert.equal(await p.textContent("#toast"), "Open com.example.gmail/.MainActivity"); + // hold a widget without moving: resize handles; drag them to snap it to the grid await longpress(".widget-slot"); - await p.click(".sheet-item >> text=Remove widget"); await settle(); + assert.ok(!(await p.$(".sheet")), "a widget gets handles, not the menu"); + assert.ok(await p.$(".widget-slot.resizing .resize-handle[data-edge=rb]")); + const size = () => p.$eval(".widget-slot", (w) => [Math.round(w.getBoundingClientRect().width), Math.round(w.getBoundingClientRect().height)]); + const [w0] = await size(); + const tile = await p.locator(".slots .tile").first().boundingBox(); + const hd = await p.locator(".resize-handle[data-edge=rb]").boundingBox(); + await p.mouse.move(hd.x + hd.width / 2, hd.y + hd.height / 2); + await p.mouse.down(); + const ws = await p.locator(".widget-slot").boundingBox(); + await p.mouse.move(ws.x + tile.width * 2.1, ws.y + 230, { steps: 8 }); await settle(); + await p.mouse.up(); await settle(); + const [w1, h1] = await size(); + assert.ok(w1 < w0 && Math.abs(w1 - (2 * tile.width + 8)) < 3, `two columns wide: ${w1} (tile ${tile.width})`); + assert.equal(h1, 250, "snapped to half rows"); + assert.ok(await p.$(".widget-slot.resizing"), "letting go of a handle keeps the handles"); + await p.click(".resize-bar >> text=Done"); await settle(); + assert.ok(!(await p.$(".resize-handle"))); + await p.reload(); await p.waitForSelector(".widget-slot"); + assert.deepEqual(await size(), [w1, h1], "the size is saved"); + await longpress(".widget-slot"); + await p.click(".resize-bar >> text=Remove"); await settle(); assert.ok(!(await p.$(".widget-slot"))); await p.evaluate(() => { window.ultraHome.reload(); }); await settle(); assert.equal(await p.$$eval(".slots > li", (ls) => ls.length), 4); diff --git a/web/app.py b/web/app.py index 74843a7..f0bca3e 100644 --- a/web/app.py +++ b/web/app.py @@ -10,7 +10,9 @@ from ui import btn_open, input_open, alert # An Android home screen. The home starts blank: you add apps and widgets to it # with a long press. Swiping down opens the drawer with every app and a search. # A long press on a home app or widget picks it up: drag it to move it, or let go -# without moving to get its menu (index.html does the dragging). +# without moving to get its menu (index.html does the dragging). Letting go of a +# widget that way shows resize handles on its right and bottom edges instead: +# dragging them snaps the widget to the grid, within the sizes it allows. # # The native shell (android/) serves this folder in a WebView, answers # apps.json and widgets.json, hosts the widgets as native views over the @@ -100,6 +102,8 @@ DROP: Const[i32] = 36 # arg: 1 if it was dragged, 0 if just held (opens WQUERY: Const[i32] = 37 # widget picker search WCLEAR: Const[i32] = 38 CHOOSE_FIRST_WIDGET: Const[i32] = 39 +RESIZE: Const[i32] = 40 # arg: columns * 4096 + height in px for the widget being resized +RESIZE_DONE: Const[i32] = 41 CAP: Const[i32] = 512 HOME_CAP: Const[i32] = 40 @@ -124,12 +128,14 @@ comps: i32[512] = empty(512, dtype=int32) icons: i32[512] = empty(512, dtype=int32) n: i32 = 0 # The home screen, in order. An app slot keeps its component name in hstr; -# a widget slot keeps the widget's label there, its host id in hwid and its -# height in CSS px in hh. hkey is a stable key for the DOM diff. +# a widget slot keeps the widget's label there, its host id in hwid, its +# height in CSS px in hh and its width in grid columns in hw (0: the whole row). +# hkey is a stable key for the DOM diff. hkind: i32[512] = empty(512, dtype=int32) hstr: i32[512] = empty(512, dtype=int32) hwid: i32[512] = empty(512, dtype=int32) hh: i32[512] = empty(512, dtype=int32) +hw: i32[512] = empty(512, dtype=int32) hkey: i32[512] = empty(512, dtype=int32) nh: i32 = 0 next_key: i32 = 1 @@ -157,6 +163,7 @@ picking: i32 = 0 # drawer is in "add apps" mode: taps toggle home slots sheet: i32 = 0 item: i32 = -1 # home slot the item sheet is about lifted: i32 = -1 # home slot picked up by a long press, being dragged +resizing: i32 = -1 # widget slot showing resize handles pending: i32 = 0 # JSON handle of a request in flight @@ -181,6 +188,7 @@ def init() -> None: hstr[nh] = h hwid[nh] = load_i32_at("ultra.home.wid", i, 0) hh[nh] = load_i32_at("ultra.home.h", i, 120) + hw[nh] = load_i32_at("ultra.home.w", i, 0) hkey[nh] = next_key next_key += 1 nh += 1 @@ -200,6 +208,7 @@ def save_home() -> None: s_save_at("ultra.home.str", i, hstr[i]) store_i32_at("ultra.home.wid", i, hwid[i]) store_i32_at("ultra.home.h", i, hh[i]) + store_i32_at("ultra.home.w", i, hw[i]) def say(msg: str) -> None: @@ -339,6 +348,7 @@ def push_slot(kind: i32, s: i32, wid: i32, h: i32) -> None: hstr[nh] = s hwid[nh] = wid hh[nh] = h + hw[nh] = 0 hkey[nh] = next_key next_key += 1 nh += 1 @@ -366,6 +376,7 @@ def remove_slot(at: i32) -> None: hstr[j] = hstr[j + 1] hwid[j] = hwid[j + 1] hh[j] = hh[j + 1] + hw[j] = hw[j + 1] hkey[j] = hkey[j + 1] nh -= 1 save_home() @@ -385,6 +396,9 @@ def swap_slots(a: i32, b: i32) -> None: t = hh[a] hh[a] = hh[b] hh[b] = t + t = hw[a] + hw[a] = hw[b] + hw[b] = t t = hkey[a] hkey[a] = hkey[b] hkey[b] = t @@ -411,17 +425,18 @@ def slot_of_widget(wid: i32) -> i32: def close_all() -> None: - global drawer, picking, sheet, item, lifted + global drawer, picking, sheet, item, lifted, resizing s_clear(query) drawer = 0 picking = 0 sheet = NONE item = -1 lifted = -1 + resizing = -1 # ---- Update def update(msg: i32, arg: i32) -> None: - global loading, drawer, picking, sheet, item, pending, wloading, chosen, lifted + global loading, drawer, picking, sheet, item, pending, wloading, chosen, lifted, resizing i: i32 if msg == LOADED: load_apps(arg) @@ -452,6 +467,7 @@ def update(msg: i32, arg: i32) -> None: launch(comps[i]) close_all() elif msg == OPEN_HOME: + resizing = -1 launch(hstr[arg]) elif msg == ADD_HOME: haptic() @@ -463,15 +479,18 @@ def update(msg: i32, arg: i32) -> None: elif nh < HOME_CAP: push_slot(APP, s_dup(comps[arg]), 0, 0) elif msg == MENU: + resizing = -1 haptic() sheet = SHEET_MENU elif msg == LIFT: if drawer == 0 and sheet == NONE: haptic() + resizing = -1 lifted = arg elif msg == WIDGET_MENU: i = slot_of_widget(arg) if i >= 0 and drawer == 0 and sheet == NONE: + resizing = -1 lifted = i elif msg == DRAG_TO: if lifted >= 0 and arg >= 0 and arg < nh and arg != lifted: @@ -479,9 +498,19 @@ def update(msg: i32, arg: i32) -> None: lifted = arg elif msg == DROP: if lifted >= 0 and arg == 0: - item = lifted - sheet = SHEET_ITEM + if hkind[lifted] == WIDGET: + resizing = lifted + else: + item = lifted + sheet = SHEET_ITEM lifted = -1 + elif msg == RESIZE: + if resizing >= 0: + hw[resizing] = arg // 4096 + hh[resizing] = arg % 4096 + save_home() + elif msg == RESIZE_DONE: + resizing = -1 elif msg == CLOSE_SHEET: sheet = NONE item = -1 @@ -510,6 +539,7 @@ def update(msg: i32, arg: i32) -> None: push_slot(WIDGET, s_dup(wlabels[chosen]), arg, wheights[chosen]) chosen = -1 elif msg == REMOVE: + resizing = -1 remove_slot(arg) sheet = NONE item = -1 @@ -544,6 +574,8 @@ def update(msg: i32, arg: i32) -> None: elif msg == BACK: if lifted >= 0: lifted = -1 + elif resizing >= 0: + resizing = -1 elif sheet != NONE: sheet = NONE item = -1 @@ -562,6 +594,34 @@ def view_icon(h: i32) -> None: end() +def view_handle(edge: str) -> None: + """A resize handle just outside the slot (the native widget covers the inside).""" + el("span") + cls("resize-handle") + attr("data-edge", edge) + attr("aria-hidden", "true") + end() + + +def view_resize_bar() -> None: + el("div") + cls("resize-bar") + attr("role", "toolbar") + el("span") + cls("resize-hint") + text("Drag the handles to resize") + end() + btn_open("ghost", REMOVE, resizing) + cls("sm") + text("Remove") + end() + btn_open("primary", RESIZE_DONE, 0) + cls("sm") + text("Done") + end() + end() + + def view_home_slot(i: i32) -> None: row: i32 if hkind[i] == WIDGET: @@ -569,20 +629,31 @@ def view_home_slot(i: i32) -> None: key(hkey[i]) cls("widget-slot") cls_if("lifted", i == lifted) + cls_if("resizing", i == resizing) attr_num("data-slot", i) - s_set(scratch, "height:") + if hw[i] > 0: + s_set(scratch, "grid-column:span ") + s_add_num(scratch, hw[i]) + s_add(scratch, ";height:") + else: + s_set(scratch, "height:") s_add_num(scratch, hh[i]) s_add(scratch, "px") attr_ref("style", scratch) # The native widget view is laid over slots marked live, so only mark - # them while nothing covers the home screen. - if drawer == 0 and sheet == NONE: + # them while nothing covers the home screen. While one is resized the + # others step aside, so nothing native covers its handles. + if drawer == 0 and sheet == NONE and (resizing < 0 or i == resizing): attr_num("data-wid", hwid[i]) on_longpress(LIFT, i) el("span") cls("widget-label") text_ref(hstr[i]) end() + if i == resizing: + view_handle("r") + view_handle("b") + view_handle("rb") end() return row = app_of(hstr[i]) @@ -626,6 +697,8 @@ def view_home() -> None: i: i32 div("home") on_longpress(MENU, 0) + if resizing >= 0: + on_click(RESIZE_DONE, 0) # a tap beside the widget finishes el("button") cls("pull") attr("aria-label", "All apps") @@ -826,6 +899,8 @@ def view() -> None: view_drawer() if sheet != NONE: view_sheet() + elif resizing >= 0 and drawer == 0: + view_resize_bar() if s_len(notice) > 0: el("div") cls("notice") diff --git a/web/app.wasm b/web/app.wasm index 45bdac8..32c6320 100644 Binary files a/web/app.wasm and b/web/app.wasm differ diff --git a/web/index.html b/web/index.html index 4a797e5..2ee7a43 100644 --- a/web/index.html +++ b/web/index.html @@ -28,6 +28,7 @@ addWidget: () => setTimeout(() => window.ultraHome.widgetAdded(demoWidget++), 0), removeWidget: () => {}, placeWidgets: () => {}, + widgetLimits: () => JSON.stringify({ minW: 120, minH: 80, maxW: 0, maxH: 0, h: true, v: true }), openSettings: () => toast("Open system settings"), pickWallpaper: () => toast("Pick a wallpaper"), openRecents: () => toast("Show open windows"), @@ -53,7 +54,14 @@ }); const j = JSON.stringify(slots); if (j !== placed) { placed = j; host.placeWidgets(j); } + // Keep the system's edge swipes (back) off the resize handles. + const handles = JSON.stringify([...document.querySelectorAll(".resize-handle")].map((h) => { + const r = h.getBoundingClientRect(); + return [Math.round(r.left), Math.round(r.top), Math.round(r.width), Math.round(r.height)]; + })); + if (handles !== excluded) { excluded = handles; host.excludeGestures?.(handles); } }; + let excluded = "[]"; // Icons: each gets its src from here. On a phone the // shell draws icons on its own thread and hands them back as data: URIs in batches @@ -113,7 +121,7 @@ // Messages the shell and the gestures below send (keep in sync with app.py). const TICK = 1, RELOAD = 2, HOME = 3, BACK = 4, SWIPE_DOWN = 5, SWIPE_UP = 6, - WIDGET_ADDED = 7, WIDGET_MENU = 8, DRAG_TO = 35, DROP = 36; + WIDGET_ADDED = 7, WIDGET_MENU = 8, DRAG_TO = 35, DROP = 36, RESIZE = 40; // Dragging a home slot. A long press lifts it (app.py marks it .lifted); moving the // finger then slides it to the slot under the finger, and letting go drops it there. @@ -155,6 +163,62 @@ addEventListener("touchmove", (e) => { if (drag && document.querySelector(".slots > .lifted") && e.cancelable) e.preventDefault(); }, { passive: false }); + + // Resizing a widget. Holding a widget and letting go without moving shows handles on + // its right edge, bottom edge and corner (app.py). Dragging one snaps the widget to + // whole grid columns and half rows, within the shell's limits for that widget + // (widgetLimits, CSS px: min/max size, 0 = no max, and whether it resizes h and v). + const CELL = 88; // a row of app tiles + let rs = null, swallowClick = false; + const span = (k, size, gap) => k * size + (k - 1) * gap; + const fit = (want, lo, hi, size, gap, min, max) => { + // the step nearest to want, kept within [min, max] px where it can be + let k = Math.round((want + gap) / (size + gap)); + while (k < hi && span(k, size, gap) < min - 8) k++; + while (k > lo && max > 0 && span(k, size, gap) > max + 8) k--; + return Math.max(lo, Math.min(hi, k)); + }; + addEventListener("pointerdown", (e) => { + const h = e.target.closest?.(".resize-handle"); + if (!h || !e.isPrimary) return; + e.stopPropagation(); e.preventDefault(); // not a long press on the slot under it + const li = h.closest("li"), slots = li.parentElement, cs = getComputedStyle(slots); + const cols = cs.gridTemplateColumns.split(" ").map(parseFloat); + const wid = +li.dataset.wid || 0; + let lim = {}; + try { lim = JSON.parse(host.widgetLimits?.(wid) || "{}"); } catch {} + const r = li.getBoundingClientRect(); + rs = { li, edge: h.dataset.edge, left: r.left, top: r.top, lim, n: cols.length, colW: cols[0], + gap: parseFloat(cs.columnGap) || 0, rgap: parseFloat(cs.rowGap) || 0, + cols: Math.round((r.width + (parseFloat(cs.columnGap) || 0)) / (cols[0] + (parseFloat(cs.columnGap) || 0))), + h: Math.round(r.height) }; + dragged = true; + h.setPointerCapture?.(e.pointerId); + }, true); + addEventListener("pointermove", (e) => { + if (!rs) return; + const { lim, n, colW, gap, rgap } = rs, half = (CELL + rgap) / 2; + let cols = rs.cols, h = rs.h; + if (rs.edge !== "b" && lim.h !== false) + cols = fit(e.clientX - rs.left, 1, n, colW, gap, lim.minW || 0, lim.maxW || 0); + if (rs.edge !== "r" && lim.v !== false) { + // half-row steps: 2 halves are one row of tiles, 4 are two rows with the gap between + const k = fit(e.clientY - rs.top + rgap, 2, 40, half, 0, (lim.minH || 0) + rgap, lim.maxH ? lim.maxH + rgap : 0); + h = Math.round(k * half - rgap); + } + if (cols === rs.cols && h === rs.h) return; + rs.cols = cols; rs.h = h; + host.haptic(); + app.dispatch(RESIZE, (cols >= n ? 0 : cols) * 4096 + h); + }, true); + const endResize = () => { if (rs) { rs = null; swallowClick = true; setTimeout(() => swallowClick = false, 0); } }; + addEventListener("pointerup", endResize, true); + addEventListener("pointercancel", endResize, true); + addEventListener("click", (e) => { // the click that ends a handle drag isn't a tap beside the widget + if (swallowClick || e.target.closest?.(".resize-handle")) { swallowClick = false; e.stopPropagation(); e.preventDefault(); } + }, true); + addEventListener("touchmove", (e) => { if (rs && e.cancelable) e.preventDefault(); }, { passive: false }); + window.ultraHome = { tick: () => { formats(); app.dispatch(TICK, 1); }, reload: () => app.dispatch(RELOAD, 0), diff --git a/web/style.css b/web/style.css index e058435..bc13db8 100644 --- a/web/style.css +++ b/web/style.css @@ -58,6 +58,27 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t border: 1px dashed rgb(255 255 255 / .3); } .widget-label { font-size: .875rem; opacity: .75; text-shadow: var(--shadow-text); } +/* A widget being resized: handles sit just outside its right and bottom edges, where the + native widget view doesn't cover them; the extra margin keeps the next row clear. */ +.widget-slot { position: relative; } +.widget-slot.resizing { margin-bottom: 1.75rem; outline: 2px solid rgb(255 255 255 / .85); + outline-offset: 3px; transition: none; } +.resize-handle { position: absolute; z-index: 2; touch-action: none; cursor: nwse-resize; } +.resize-handle::after { content: ""; position: absolute; border-radius: 999px; background: #fff; + box-shadow: 0 1px 6px rgb(0 0 0 / .45); } +.resize-handle[data-edge="r"] { top: 0; bottom: 0; right: -16px; width: 16px; cursor: ew-resize; } +.resize-handle[data-edge="r"]::after { top: 50%; left: 6px; width: 6px; height: 2.5rem; transform: translateY(-50%); } +.resize-handle[data-edge="b"] { left: 0; right: 0; bottom: -1.75rem; height: 1.75rem; cursor: ns-resize; } +.resize-handle[data-edge="b"]::after { left: 50%; top: 8px; width: 2.5rem; height: 6px; transform: translateX(-50%); } +.resize-handle[data-edge="rb"] { right: -16px; bottom: -1.75rem; width: 2.75rem; height: 1.75rem; } +.resize-handle[data-edge="rb"]::after { right: 4px; top: 6px; width: 14px; height: 14px; border-radius: 4px; } +.resize-bar { position: fixed; left: 50%; bottom: calc(var(--bottom) + 1rem); z-index: 15; transform: translateX(-50%); + display: flex; align-items: center; gap: .5rem; padding: .4rem .4rem .4rem 1rem; border-radius: 999px; + background: rgb(0 0 0 / .8); color: #fff; font-size: .875rem; white-space: nowrap; + animation: ui-fade .15s; } +.resize-bar .btn.ghost { color: #fff; } +.resize-bar .btn.ghost:hover { background: rgb(255 255 255 / .12); color: #fff; } + /* A slot picked up by a long press, while it is dragged (index.html moves it). */ .slots > li { transition: transform .15s ease-out; } .slots > .lifted { z-index: 1; transform: scale(1.12); background: rgb(255 255 255 / .16);