@@ -252,29 +252,32 @@ export default class PresentationCanvasExtension extends CanvasExtension {
252252 private async animateNodeTransition ( canvas : Canvas , fromNode : CanvasNode | undefined , toNode : CanvasNode ) {
253253 const useCustomZoomFunction = this . plugin . settings . getSetting ( 'zoomToSlideWithoutPadding' )
254254 const animationDurationMs = this . plugin . settings . getSetting ( 'slideTransitionAnimationDuration' ) * 1000
255+
256+ const toNodeBBox = CanvasHelper . getSmallestAllowedZoomBBox ( canvas , toNode . getBBox ( ) )
255257
256258 if ( animationDurationMs > 0 && fromNode ) {
257259 const animationIntensity = this . plugin . settings . getSetting ( 'slideTransitionAnimationIntensity' )
258260
259- const currentNodeBBoxEnlarged = BBoxHelper . scaleBBox ( fromNode . getBBox ( ) , animationIntensity )
261+ const fromNodeBBox = CanvasHelper . getSmallestAllowedZoomBBox ( canvas , fromNode . getBBox ( ) )
262+
263+ const currentNodeBBoxEnlarged = BBoxHelper . scaleBBox ( fromNodeBBox , animationIntensity )
260264 if ( useCustomZoomFunction ) CanvasHelper . zoomToRealBBox ( canvas , currentNodeBBoxEnlarged )
261265 else canvas . zoomToBbox ( currentNodeBBoxEnlarged )
262266
263267 await sleep ( animationDurationMs / 2 )
264268
265269 if ( fromNode . getData ( ) . id !== toNode . getData ( ) . id ) {
266270 // Add 0.1 to fix obsidian bug that causes the animation to skip if the bbox is the same
267- const nextNodeBBoxEnlarged = BBoxHelper . scaleBBox ( toNode . getBBox ( ) , animationIntensity + 0.1 )
271+ const nextNodeBBoxEnlarged = BBoxHelper . scaleBBox ( toNodeBBox , animationIntensity + 0.1 )
268272 if ( useCustomZoomFunction ) CanvasHelper . zoomToRealBBox ( canvas , nextNodeBBoxEnlarged )
269273 else canvas . zoomToBbox ( nextNodeBBoxEnlarged )
270274
271275 await sleep ( animationDurationMs / 2 )
272276 }
273277 }
274278
275- let nodeBBox = toNode . getBBox ( )
276- if ( useCustomZoomFunction ) CanvasHelper . zoomToRealBBox ( canvas , nodeBBox )
277- else canvas . zoomToBbox ( nodeBBox )
279+ if ( useCustomZoomFunction ) CanvasHelper . zoomToRealBBox ( canvas , toNodeBBox )
280+ else canvas . zoomToBbox ( toNodeBBox )
278281 }
279282
280283 private async startPresentation ( canvas : Canvas , tryContinue : boolean = false ) {
@@ -304,6 +307,10 @@ export default class PresentationCanvasExtension extends CanvasExtension {
304307 // Lock canvas
305308 canvas . setReadonly ( true )
306309
310+ // Disable zoom clamping
311+ if ( this . plugin . settings . getSetting ( 'useUnclampedZoomWhilePresenting' ) )
312+ canvas . screenshotting = true
313+
307314 // Register event handler for keyboard navigation
308315 canvas . wrapperEl . onkeydown = ( e : any ) => {
309316 if ( this . plugin . settings . getSetting ( 'useArrowKeysToChangeSlides' ) ) {
@@ -361,6 +368,10 @@ export default class PresentationCanvasExtension extends CanvasExtension {
361368
362369 // Unlock canvas
363370 canvas . setReadonly ( false )
371+
372+ // Re-enable zoom clamping
373+ if ( this . plugin . settings . getSetting ( 'useUnclampedZoomWhilePresenting' ) )
374+ canvas . screenshotting = false
364375
365376 // Exit fullscreen mode
366377 canvas . wrapperEl . classList . remove ( 'presentation-mode' )
@@ -420,10 +431,7 @@ export default class PresentationCanvasExtension extends CanvasExtension {
420431 if ( ! fromNode ) return
421432
422433 const toNodeId = this . visitedNodeIds . last ( )
423- if ( ! toNodeId ) return
424-
425- let toNode = canvas . nodes . get ( toNodeId )
426- if ( ! toNode ) return
434+ let toNode = toNodeId ? canvas . nodes . get ( toNodeId ) : null
427435
428436 // Fall back to same node if there are no more nodes before
429437 if ( ! toNode ) {
0 commit comments