@@ -117,14 +117,17 @@ function _centerAtDepth(pInst, d) {
117117 * @param {p5.Camera|null } cam
118118 * @param {boolean } isCameraTrack
119119 * @param {p5 } pInst
120+ * @param {boolean } showReset When false, w.reset is omitted and _createPanel
121+ * suppresses the reset button. Use when keyframes are immutable by design.
120122 * @returns {Object }
121123 */
122- function _wrapTrack ( track , cam , isCameraTrack , pInst ) {
124+ function _wrapTrack ( track , cam , isCameraTrack , pInst , showReset ) {
123125 const _snapOut = isCameraTrack
124126 ? { eye :[ 0 , 0 , 0 ] , center :[ 0 , 0 , 0 ] , up :[ 0 , 1 , 0 ] , fov :null , halfHeight :null }
125127 : { pos :[ 0 , 0 , 0 ] , rot :[ 0 , 0 , 0 , 1 ] , scl :[ 1 , 1 , 1 ] } ;
126128
127129 const _captureOut = { eye :[ 0 , 0 , 0 ] , center :[ 0 , 0 , 0 ] , up :[ 0 , 1 , 0 ] , fov :null , halfHeight :null } ;
130+ const _addOut = { eye :[ 0 , 0 , 0 ] , center :[ 0 , 0 , 0 ] , up :[ 0 , 1 , 0 ] , fov :null , halfHeight :null } ;
128131
129132 function _applySnap ( ) {
130133 if ( isCameraTrack && cam && track . keyframes . length > 0 ) cam . applyPose ( track . eval ( _snapOut ) ) ;
@@ -150,8 +153,8 @@ function _wrapTrack(track, cam, isCameraTrack, pInst) {
150153 seek : ( t ) => { track . seek ( t ) ; _applySnap ( ) ; } ,
151154 time : ( ) => track . time ( ) ,
152155 } ;
153- if ( typeof track . reset === 'function' ) w . reset = ( ) => track . reset ( ) ;
154- if ( typeof track . info === 'function' ) w . info = ( ) => track . info ( ) ;
156+ if ( showReset && typeof track . reset === 'function' ) w . reset = ( ) => track . reset ( ) ;
157+ if ( typeof track . info === 'function' ) w . info = ( ) => track . info ( ) ;
155158
156159 // Forward lib-space hook slots to the underlying track.
157160 // trackUI assigns w._onPlay / _onEnd / _onStop; track.play() fires track._onPlay.
@@ -172,7 +175,10 @@ function _wrapTrack(track, cam, isCameraTrack, pInst) {
172175
173176 if ( cam !== null && typeof track . add === 'function' ) {
174177 if ( isCameraTrack ) {
175- w . add = ( ) => track . add ( cam . capturePose ( ) ) ;
178+ w . add = ( ) => {
179+ cam . capturePose ( _addOut ) ;
180+ track . add ( _addOut , { deduplicate : false } ) ;
181+ } ;
176182 } else {
177183 w . add = ( d ) => {
178184 const pos = _centerAtDepth ( pInst , typeof d === 'number' ? d : 0.5 ) || [ 0 , 0 , 0 ] ;
@@ -215,8 +221,11 @@ export function installPanel(p5, fn) {
215221 * // PoseTrack — explicit camera override
216222 * createPanel(track, { camera: cam2, x: 10, y: 10 })
217223 *
218- * // PoseTrack — suppress + button
224+ * // Suppress + button (camera: null)
219225 * createPanel(track, { camera: null, x: 10, y: 10 })
226+ *
227+ * // Suppress reset button
228+ * createPanel(track, { reset: false, x: 10, y: 10 })
220229 * ```
221230 *
222231 * **Param panel** (shader uniforms, scene parameters):
@@ -241,7 +250,10 @@ export function installPanel(p5, fn) {
241250 * Layout and behaviour options.
242251 * @param {p5.Camera|null } [opt.camera]
243252 * Track panels only. Override camera for + button.
244- * null suppresses the + button. Defaults to curCamera.
253+ * null suppresses the + button. Defaults to track.camera for CameraTrack,
254+ * curCamera for PoseTrack.
255+ * @param {boolean } [opt.reset=true]
256+ * Track panels only. Set false to suppress the reset button.
245257 * @param {Object|Function } [opt.target]
246258 * Param panels only. Value sink: p5 shader, (name,val)=>..., or {set}.
247259 * @param {(HTMLElement|p5.Element) } [opt.parent]
@@ -264,10 +276,13 @@ export function installPanel(p5, fn) {
264276 if ( typeof opt . onEnd === 'function' ) { track . onEnd = opt . onEnd ; delete opt . onEnd ; }
265277 if ( typeof opt . onStop === 'function' ) { track . onStop = opt . onStop ; delete opt . onStop ; }
266278
279+ const showReset = opt . reset !== false ;
280+ delete opt . reset ;
281+
267282 // Resolve camera for + button.
268283 let cam ;
269284 if ( 'camera' in opt ) {
270- cam = opt . camera === null ? null
285+ cam = opt . camera === null ? null
271286 : opt . camera instanceof p5 . Camera ? opt . camera
272287 : ( pInst . _renderer ?. states ?. curCamera ?? null ) ;
273288 } else if ( isCameraTrack ) {
@@ -280,7 +295,7 @@ export function installPanel(p5, fn) {
280295 // Depth slider not meaningful for camera tracks.
281296 if ( isCameraTrack && ! ( 'depth' in opt ) ) opt . depth = false ;
282297
283- const panel = _createPanel ( _wrapTrack ( track , cam , isCameraTrack , pInst ) , opt ) ;
298+ const panel = _createPanel ( _wrapTrack ( track , cam , isCameraTrack , pInst , showReset ) , opt ) ;
284299 registerPlayer ( pInst , { tick ( ) { panel . tick ( ) ; return true ; } } ) ;
285300 return panel ;
286301 }
0 commit comments