Skip to content

Commit ddc857b

Browse files
ryan-williamsclaude
andcommitted
demo(/2): direct-manipulation card grid — drag/rotate/crop/reorder/resize
Replaces the prior text-only "What's added" features list with an interactive showcase: 4 cols × 2 rows of colored-rect SVG cards, each demoing one of the fork's direct-manipulation features: - rotate (-15° tilt) / drag (with 4-arrow icon + "hold ⌘ to disable snap") - crop (mild) / crop (aggressive) — both say "double-click to crop" - reorder (back, z=101) / reorder (front, z=1000) — partial overlap, hotkey hints burned in - resize (AR-locked, bigger) / resize (free-AR, stretched) — each labeled All cards are `<img v-drag>` so dblclick → crop mode works on any of them. SVGs use `preserveAspectRatio="none"` so x/y-resize stretches the artwork to fill the wrapper instead of letterboxing — trade-off: rounded corners go elliptical when the wrapper distorts from the natural 1.71:1 AR. `feat-resize-locked` uses the new `data-lock-ar="1.7143"` directive attribute to keep AR; corner handles preserve ratio, L/R/T/B border handles are hidden. slides.coords.yaml carries the default positions for all 8 cards. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5b98693 commit ddc857b

10 files changed

Lines changed: 79 additions & 47 deletions
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 13 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

demo/starter/slides.coords.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
# Slidev drag coords — auto-managed by the dev server.
22
# Tracked in git by default; add to .gitignore if you'd rather keep positions personal.
33
# Top-level keys are slide numbers (1-based); values are dragId → posStr.
4-
{}
4+
"1":
5+
ClZua: 530,460,160,72
6+
"2":
7+
feat-reorder-2: 503,228,180,105,0,1000
8+
feat-crop: 287,172,180,105,0,100,16,16,10,7
9+
feat-crop-2: 288,251,180,105,0,100,28,9,28,28
10+
feat-drag: 85,325,180,105
11+
feat-rotate: 76,174,180,105,-15
12+
feat-reorder-1: 483,178,180,105,0,101
13+
feat-resize-locked: 696,174,235,137
14+
feat-resize: 696,327,264,93

demo/starter/slides.md

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,7 @@ publish:
3333

3434
# <span class="font-mono">Open&#8209;Athena<span class="opacity-50">/</span>slidev</span>
3535

36-
A fork that adds <span class="text-white font-semibold">direct manipulation</span> — click + drag, snap, crop, undo, multi-tab live edits.
37-
38-
<v-drag pos="410,400,160,56">
39-
<div class="bg-primary text-white rounded-lg shadow-xl cursor-move font-medium select-none w-full h-full flex items-center justify-center">
40-
👈 drag me
41-
</div>
42-
</v-drag>
36+
A fork of <a href="https://sli.dev" target="_blank" class="text-white font-semibold underline underline-offset-4 decoration-white/40 hover:decoration-white">sli.dev</a> that adds <span class="text-white font-semibold">direct manipulation</span> — click + drag, snap, crop, undo, multi-tab live edits.
4337

4438
<div class="abs-bl m-6 text-sm">
4539
<a href="https://github.com/Open-Athena/slidev" target="_blank" class="text-white !text-opacity-90 hover:!text-opacity-100 underline underline-offset-4 decoration-white/40 hover:decoration-white">
@@ -54,53 +48,34 @@ Press space / → to advance.
5448

5549
---
5650
layout: default
51+
title: Direct manipulation
5752
---
5853

59-
# What's added
60-
61-
The slides that follow are the unmodified upstream `slidev` starter deck — these capabilities are active throughout:
62-
63-
<div class="grid grid-cols-2 gap-x-8 gap-y-3 mt-6 text-base">
64-
65-
<div>
66-
67-
**Click + drag** to move any `<v-drag>` element body.
68-
69-
</div><div>
70-
71-
**Snap-align** to edges/centers of other elements; **Shift** / **** disables.
72-
73-
</div><div>
74-
75-
**Resize · rotate · crop** — handles on selected elements; double-click an image to crop, **Alt** locks AR.
76-
77-
</div><div>
78-
79-
**Z-order**: ⌘↑ / ⌘↓ forward/back; **Shift** for to-front/to-back.
54+
# Direct manipulation
8055

81-
</div><div>
56+
In OA/slidev, click any image to **drag**, **resize**, **rotate**, or **reorder** it; **double-click** to enter **crop** mode. Try it on the cards below.
8257

83-
**Undo / redo** with Cmd+Z / Cmd+Shift+Z, persisted across reloads.<br/>**History drawer** shows every edit; click to restore.
84-
85-
</div><div>
86-
87-
**Insert image**: press `i` to pick, or drop image / video files on the slide.
88-
89-
</div><div>
90-
91-
**Mobile**: pinch-zoom + pan slides; pinch-vs-drag guards on touch elements.
92-
93-
</div><div>
94-
95-
**Live multi-tab editing** — drag in one tab, see it in all others (dev server: SSE; static deploys: localStorage events).
58+
<img v-drag="'feat-rotate'" src="/feature-rotate.svg">
59+
<img v-drag="'feat-drag'" src="/feature-drag.svg">
60+
<img v-drag="'feat-crop'" src="/feature-crop.svg">
61+
<img v-drag="'feat-crop-2'" src="/feature-crop-2.svg">
62+
<img v-drag="'feat-reorder-1'" src="/feature-reorder.svg">
63+
<img v-drag="'feat-reorder-2'" src="/feature-reorder-2.svg">
64+
<img v-drag="'feat-resize'" src="/feature-resize.svg">
65+
<img v-drag="'feat-resize-locked'" src="/feature-resize-locked.svg" data-lock-ar="1.7143">
9666

67+
<div class="abs-b mb-3 w-full text-center text-xs opacity-60">
68+
Reorder: <kbd>⌘↑</kbd> / <kbd>⌘↓</kbd> forward/back · <kbd>⇧⌘↑</kbd> / <kbd>⇧⌘↓</kbd> to-front/back &nbsp;·&nbsp; Undo / redo: <kbd>⌘Z</kbd> / <kbd>⇧⌘Z</kbd>
9769
</div>
9870

99-
</div>
71+
---
72+
layout: center
73+
class: text-center
74+
---
10075

101-
<div class="mt-8 text-sm opacity-60">
102-
Try the draggable Tweet on the "Components" slide, or the example boxes on the "Draggable Elements" slide.
103-
</div>
76+
# Upstream `slidev` deck follows
77+
78+
The fork's direct-manipulation features are active throughout — try grabbing the Tweet on the Components slide, or the logo on the Draggable Elements slide.
10479

10580
---
10681

0 commit comments

Comments
 (0)