Skip to content

Commit 2f800d7

Browse files
committed
feat(example): sample image picker, calibration from test_cases, and UI tweaks
- Add sample thumbnails (cam1/cam2) with per-camera calibration from test_cases.json - Replace centerX/centerY with fx/fy/cx/cy; add rectilinear, original, cylindrical presets - Add loadRequestId so output canvas stays in sync when switching samples - Sidebar toggle: "Settings" label, SVG icon, layout and hover styles - Sample thumb grid and thumb styles in fisheye-demo.styles - Renderer: await onSubmittedWorkDone before closing frame - Remove example/public/test.jpg
1 parent 70f2dd2 commit 2f800d7

11 files changed

Lines changed: 277 additions & 55 deletions

File tree

example/public/samples/cam1_01.jpg

1.05 MB
Loading

example/public/samples/cam1_02.jpg

1.05 MB
Loading

example/public/samples/cam1_03.jpg

1.04 MB
Loading

example/public/samples/cam2_01.jpg

943 KB
Loading

example/public/samples/cam2_02.jpg

941 KB
Loading

example/public/samples/cam2_03.jpg

924 KB
Loading

example/public/test.jpg

-4.47 MB
Binary file not shown.

example/src/demo-sidebar.ts

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { css, html, LitElement } from "lit";
22
import { customElement, property } from "lit/decorators.js";
33

4-
const SIDEBAR_TOGGLE_WIDTH = 48;
4+
const SIDEBAR_TOGGLE_WIDTH = 52;
55

66
@customElement("demo-sidebar")
77
export class DemoSidebar extends LitElement {
@@ -15,27 +15,39 @@ export class DemoSidebar extends LitElement {
1515
.sidebar-toggle {
1616
width: 100%;
1717
min-height: 3rem;
18-
padding: 0;
18+
padding: 0 0.25rem;
1919
background: #0f3460;
2020
border: none;
2121
border-right: 1px solid #1a3a5c;
2222
color: #00d9ff;
23-
font-size: 1rem;
23+
font-size: 0.8125rem;
2424
cursor: pointer;
2525
display: flex;
26+
flex-direction: column;
2627
align-items: center;
2728
justify-content: center;
28-
transition: background 0.15s;
29+
gap: 0.25rem;
30+
transition: background 0.15s, color 0.15s;
2931
}
3032
3133
.sidebar-toggle:hover {
3234
background: #1a3a5c;
35+
color: #fff;
3336
}
3437
3538
.sidebar-toggle .icon {
39+
width: 20px;
40+
height: 20px;
41+
flex-shrink: 0;
3642
transition: transform 0.25s ease;
3743
}
3844
45+
.sidebar-toggle .label {
46+
line-height: 1.1;
47+
font-weight: 500;
48+
letter-spacing: 0.02em;
49+
}
50+
3951
.sidebar-toggle[aria-expanded="true"] .icon {
4052
transform: rotate(180deg);
4153
}
@@ -46,12 +58,19 @@ export class DemoSidebar extends LitElement {
4658
}
4759
4860
.sidebar-toggle {
61+
flex-direction: row;
4962
width: 100%;
5063
height: ${SIDEBAR_TOGGLE_WIDTH}px;
64+
padding: 0 0.75rem;
5165
border-right: none;
5266
border-bottom: 1px solid #1a3a5c;
5367
}
5468
69+
.sidebar-toggle .label {
70+
flex: 1;
71+
text-align: left;
72+
}
73+
5574
.sidebar-toggle[aria-expanded="true"] .icon {
5675
transform: rotate(0deg);
5776
}
@@ -68,16 +87,24 @@ export class DemoSidebar extends LitElement {
6887
this.dispatchEvent(new CustomEvent("toggle", { bubbles: true, composed: true }));
6988
}
7089

90+
private get toggleLabel(): string {
91+
return this.open ? "Close settings" : "Open settings";
92+
}
93+
7194
render() {
7295
return html`
7396
<button
7497
type="button"
7598
class="sidebar-toggle"
7699
@click=${this.toggle}
77100
aria-expanded=${this.open}
78-
aria-label=${this.open ? "Close sidebar" : "Open sidebar"}
101+
aria-label=${this.toggleLabel}
102+
title=${this.toggleLabel}
79103
>
80-
<span class="icon" aria-hidden="true"></span>
104+
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
105+
<path d="M9 18l6-6-6-6" stroke-linecap="round" stroke-linejoin="round"/>
106+
</svg>
107+
<span class="label">Settings</span>
81108
</button>
82109
`;
83110
}

example/src/fisheye-demo.styles.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,56 @@ export const fisheyeDemoStyles = css`
100100
cursor: pointer;
101101
}
102102
103+
.sidebar-form .sample-thumbnails {
104+
display: grid;
105+
grid-template-columns: repeat(3, 1fr);
106+
gap: 0.5rem;
107+
margin-bottom: 1rem;
108+
}
109+
110+
.sidebar-form .sample-thumb {
111+
display: flex;
112+
flex-direction: column;
113+
align-items: center;
114+
gap: 0.25rem;
115+
padding: 0.35rem;
116+
background: #0f3460;
117+
border: 2px solid #1a3a5c;
118+
border-radius: 8px;
119+
cursor: pointer;
120+
transition: all 0.15s;
121+
}
122+
123+
.sidebar-form .sample-thumb:hover {
124+
border-color: #00d9ff;
125+
background: #1a3a5c;
126+
}
127+
128+
.sidebar-form .sample-thumb.active {
129+
border-color: #00d9ff;
130+
background: rgba(0, 217, 255, 0.15);
131+
}
132+
133+
.sidebar-form .sample-thumb img {
134+
width: 100%;
135+
aspect-ratio: 4/3;
136+
object-fit: cover;
137+
border-radius: 4px;
138+
}
139+
140+
.sidebar-form .sample-thumb span {
141+
font-size: 0.65rem;
142+
color: #8892b0;
143+
white-space: nowrap;
144+
overflow: hidden;
145+
text-overflow: ellipsis;
146+
max-width: 100%;
147+
}
148+
149+
.sidebar-form .sample-thumb.active span {
150+
color: #00d9ff;
151+
}
152+
103153
.sidebar-form .file-input-wrapper {
104154
position: relative;
105155
}

0 commit comments

Comments
 (0)