Commit graph

15 commits

Author SHA1 Message Date
10ea3ca071 Fix license headers: correct copyright owner and add SPDX identifiers
JS files had wrong copyright owner (The Forgejo Authors → Bruno Postle).
Python files lacked SPDX-License-Identifier: LGPL-3.0-or-later.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 21:07:23 +01:00
0e855d8413 Revert BCF snapshot debug logging 2026-05-17 22:59:20 +01:00
10017f01e4 Debug BCF snapshot: log rendererCanvas and toDataURL result 2026-05-17 22:50:02 +01:00
97ae246aa2 Strip Clearance representation geometry before loading IFC in viewer
web-ifc disposes its IfcAPI after load so context filtering must happen
before the buffer reaches ifcLoader.load(). Pre-process the IFC-SPF buffer
to find IfcGeometricRepresentationSubContext entities with ContextIdentifier
'Clearance', then empty the items list of any IFCSHAPEREPRESENTATION that
references those contexts, so door-swing and equipment-clearance volumes
produce no geometry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 10:56:13 +01:00
369b7f98e3 Fix model reload transition: snapshot overlay + bfcache handling
- Inline script at top of <body> creates the snapshot overlay immediately
  on page load, before the deferred module script runs, eliminating the
  black flash between navigation and overlay appearance
- Save a JPEG snapshot to sessionStorage before navigating to a new ref;
  the overlay covers the blank WebGL canvas while the model reloads
- Fade the overlay out after two animation frames post-load so the canvas
  has painted before the transition begins
- Reload on pageshow with persisted=true: bfcache restore left the WebGL
  canvas blank and skipped the inline script; a fresh reload lets the
  snapshot overlay work correctly
- Replace native <datalist> ref picker with a custom dropdown; the native
  datalist won't open programmatically via .focus() in most browsers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 10:23:29 +01:00
afc966fdf6 Avoid full model reload for view-only URL changes (camera, clip, selector)
When the ifc:// URL is edited and Enter pressed, capture toRawUrl() of
the loaded model at load time. On any subsequent loadUrl() call, compare
against that snapshot: if the raw file URL is unchanged, call the new
applyViewChanges() function in-place instead of navigating to a new page.

applyViewChanges() diffs old vs new URL query params and applies only what
changed: camera position (with cameraControls.update(0) flush before
render), FOV/scale, clipping planes, selector/visibility, and query. A
full page reload now only happens when host, repo, ref, or path changes.

Fixes ifcurl-ntm.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 09:12:40 +01:00
b3e37c512a Fix query panel visibility and meta panel type counts
- Add /query proxy rule to nginx config (was missing, caused 404)
- Fix populateMetaPanel: call groupData.get() instead of reading empty
  groupData.map, and use ids.size (Set) not ids.length
- Update CLAUDE.md check #17 to reflect type counts now working

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 21:02:54 +01:00
c05ed370aa Fix viewer camera offset: disable COORDINATE_TO_ORIGIN in web-ifc
web-ifc's COORDINATE_TO_ORIGIN=true shifts all model geometry so the first
element lands at origin (≈12m shift for simple-ifc). GetCoordinationMatrix
returns identity despite the shift, so engine_fragment can't compensate.
Camera URLs are in IFC world coords (per spec §5), but the model was in
shifted coords, causing the JS viewer and Python renderer to disagree.

Set COORDINATE_TO_ORIGIN: false in ifcLoader.setup() so model geometry
stays in IFC world coords, matching what IfcOpenShell outputs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 12:40:05 +01:00
Claude
38161604f9 Viewer: query field and results table (ifcurl-2iv, ifcurl-4u3)
viewer-url.js: parseIfcUrl returns query field; buildIfcUrl gains optional
fifth query param, included in the QS when non-empty.

viewer.html: add 'query' text field (label + input) in toolbar row 2
after the visibility selector. Add #query-panel (fixed bottom-centre)
with a scrollable table showing GlobalId | value rows, a header
displaying the query path, and a close button.

viewer.js: populate queryInput from parsed URL on load; include query
in buildIfcUrl() wrapper; wire queryInput into Enter-key and focus/blur
listeners. Add applyQuery(srcUrl, queryPath) which calls GET /query,
populates the table, and shows the panel. Called from main() after
applySelector when both selector and query params are present.

viewer-url.test.js: add tests for parseIfcUrl query field, buildIfcUrl
with query, and buildIfcUrl omitting empty query.

https://claude.ai/code/session_01NBsytCd6L7UQPiKbcLn4kn
2026-05-09 11:09:55 +00:00
Claude
8d13757c4d Viewer: add clash visibility mode (ifcurl-982)
viewer.html: add 'clash' option to the visibility <select> dropdown.

viewer.js: add clash branch in applySelector for both the simple
type-selector path and the complex server-side GUID path. Selected
elements are coloured 0xdc3232 (red, matching render.py's _CLASH_COLOR);
non-selected elements remain at their normal material colours, consistent
with highlight mode behaviour.

https://claude.ai/code/session_01NBsytCd6L7UQPiKbcLn4kn
2026-05-09 09:03:11 +00:00
4b96ee3206 viewer: show status hint when clip mode is active
Displays "Double-click model surface to place clip plane" in the status
bar when clip mode is toggled on, clears it when toggled off.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 22:30:24 +01:00
950349941c forgejo: add @thatopen/components-front, fix click-to-identify and model overview
Bundle OBCF (components-front) alongside OBC so Highlighter is sourced from the
correct package.  Update click handler to use item.getGuid() — GlobalId is no
longer in the attributes map in fragments 3.4.x.  Fix populateMetaPanel crash
(ClassificationGroupData now wraps ids in a .map property, not a plain object).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-28 00:01:19 +01:00
d60bd044dd forgejo: add JS unit tests, extract pure functions into viewer-util.js
Extract parseCommitHref, isSimpleTypeSelector, subtractIdMap, and
isCommitHash into a new viewer-util.js ES module so they can be tested
without a browser. Convert ifcurl.js from an IIFE to an ES module
importing from viewer-util.js; update footer.tmpl to type="module".

Add node:test suites for viewer-url.js (32 tests) and viewer-util.js
(28 tests). Add npm test script and document it in the build section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 20:24:58 +01:00
a1a7a6c829 forgejo: handle ifc:// markdown links in JS, eliminate required Go compile
- ifcurl.js: scan a[href^="ifc://"] at page load and replace with preview
  figures — works with [title](ifc://...) syntax without any Go extension
- viewer.js: Issue button now emits [title](ifc://...) markdown link syntax
  instead of a bare URL, so shared views render as previews without the patch
- README: document no-rebuild quick setup path; Go patch section is now optional

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 08:25:34 +01:00
36f528a254 viewer: extract inline JS into viewer.js
viewer.html was ~1250 lines of almost entirely JavaScript. The script
block is now a single <script type="module" src="./viewer.js"> tag,
leaving viewer.html as pure HTML/CSS (~238 lines).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 15:50:28 +01:00