Find working expand depth control: view.set_depth + plugin.draw

After testing plugin_config.expand_depth (no effect) and view.set_depth
+ flush() (no effect), confirmed that view.set_depth(d) followed by
plugin.draw(view) correctly collapses/expands all rows to depth d.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-04-15 08:05:10 -04:00
parent 0b8c2935d7
commit 3a172e2456

View File

@ -290,13 +290,21 @@ export default function Pivot({ source }) {
{/* expand_depth test buttons */} {/* expand_depth test buttons */}
<div className="ml-auto flex items-center gap-1"> <div className="ml-auto flex items-center gap-1">
<span className="text-xs text-gray-300">expand test:</span> <span className="text-xs text-gray-300">expand test:</span>
<button onClick={async () => {
const v = viewerRef.current; if (!v) return
const view = await v.getView()
const viewMethods = Object.getOwnPropertyNames(Object.getPrototypeOf(view))
console.log('view methods:', viewMethods)
}} className="text-xs border border-gray-200 rounded px-1.5 py-0.5 text-gray-500 hover:border-gray-400">
log
</button>
{[0, 1, 2, 3].map(d => ( {[0, 1, 2, 3].map(d => (
<button key={d} onClick={async () => { <button key={d} onClick={async () => {
const v = viewerRef.current; if (!v) return const v = viewerRef.current; if (!v) return
const cfg = await v.save() const view = await v.getView()
const next = { ...cfg, plugin_config: { ...cfg.plugin_config, expand_depth: d } } await view.set_depth(d)
console.log('trying plugin_config expand_depth:', d, next) const p = await v.getPlugin()
await v.restore(next) await p.draw(view)
}} className="text-xs border border-gray-200 rounded px-1.5 py-0.5 text-gray-500 hover:border-gray-400"> }} className="text-xs border border-gray-200 rounded px-1.5 py-0.5 text-gray-500 hover:border-gray-400">
{d} {d}
</button> </button>