Overview# To zoom to a specific area in Mirador 3, you can use the method described below.
https://github.com/ProjectMirador/mirador/wiki/M3---Mirador-3-Frequently-Asked-Questions#q-how-do-i-change-the-view-of-an-image-to-zoom-to-a-certain-area
Specifically, it looks like this.
c } c } v } m o ; o ; a ) i n x y w h n x y r x y z ; r B s : : i e s : : : : o a o t d i t a o d x 1 1 t g b b c z z m o b 4 8 h h z o o t o o : r t o 2 3 : t o x x i o o I o x 0 1 : o T T o m m 1 n T , , 8 m o o n C C s z o 0 1 C Z Z e e / t o Z 0 1 e o o = n n a o o , 9 n o o t t b n m o 5 t m m M e e o c m e . . i r r x e t r x y r . . T . o = a x y o s = + + d , , Z t { o o o { b b r o r o o . m e x x a . . T T c w d o o t i i Z Z i d s o o o t p o o n h a m m s t . . . c w h u h i e p ( d i d a t g a c h h t t t e i / V o / i n 2 e ) , 2 w ; p o r t ( w i n d o w I d , { Internally, it appears that OpenSeadragon’s panTo and zoomTo are used.
The issue here is that zoomTo ignores constraints when zooming, as described in the following article.
https://github.com/openseadragon/openseadragon/issues/881
To address this, as shown in the following article, adding viewer.viewport.applyConstraints(); enables zooming that respects constraints.
Below, I introduce a somewhat forceful method to apply this setting to Mirador installed via npm.
Editing Mirador# Install Mirador with the following command.
n p m i n s t a l l m i r a d o r
A mirador folder is created under node_modules.
The following is an example of adding viewport.applyConstraints(); to a file within that folder.
{ k v } e a y l v v t i } i } } } : u a a h f f e r r i i } t r v v t e t e v i } i } i } i } " : s ( f h e ( i a h l h l a f f f f c _ v c v . p v v v v i t ! e r i s i s r v v v v v o f t i a i a r i i i i s u t w s e s e i i i i i m u h e n e p e v e e e e . r h e c . . v v e v e e v e v e p n i w v w i v i w w w w a n i r a a i r i i i w i w w i w i w o c s e a e R S e e e e e d ; s . n d f e f e e p e p p e p e p n t $ r s r e t w r r r r d . c v d f w w o w o o w o w o e i p C W f a e . . C C A i l a A ( r p e r e r r e r e r n o r o o = . t r v v o o l n o s l ! e v o r t r t t r t r t t n o n r c e C i i n n l f s e l i s i r C . C . . C . C . D p f l t u . o e e f f I o e s I s h e t o p o z a o s o s i c s i d h r v n w w i i m R ( C m E T w n a n o p n e n e d o 2 g i r i f p p g g a e ) h a q i e = f n f o p f t f t U m = s e e i o o . . g s ; a g u l r i T i m l i R i F p p = = . n w g r r d f e p n e a e C v g o g T y g o g l d o _ s t e ) t t e l S o g S l P o i . ( . o C . t . i a n t _ t t r . . g i o n e o ( r n e x v z ( o r a f p t e h t h a = { p z r p u s d u c o f w i o v n o t l ( e n i h i t = a o e r e r a p i e ! e o i s t i i v " t s i s e v = n o e ! c s = c n e g r = w m e t a o p i , D . s $ . i = T m s = e M e v r . = e w r t n e i p $ p v e o T = s a ! s a t & v r ! e a i ( ! w d r p r i w u ( o ! ( t i ( s i & i v C = r i o v = e U o r o e e n v ( = u ! c s c W e e i o = C n n i = r p p o p w r d i v = n v h E a o s ! w e n o t e C d s p s e ; e e i d i ( q n r ( t p w f v n s ! w v o a , s 2 r f w e u e e p u v l ) h o p i i f ( = e i n t 2 . ; i e w n f w r a a d ; i r o g e i ) = r e f e . c n r e d i e e l s . s t r , w g ; C w i ( v a e C r e n r v ( e l . ; t p . v o p g p i n d o C f e C P c s a o . f o z i n o . r e v ) n o i d o r a C y s c a r e f r f e w a f n n n o n h e d e l t w i t l v e s { i f e & f p v a r U n s . m A p g . i P r W g i d & i s a n s p t e z , d o . g p r C o , g g . s g , d e ) o d r r e ) o o r . & v ) i W e a r ; o v e t o t ; p n l t z & i ; n o d p t S m i d . t F s f d r o e f r r i p S e g a l , i ; u o v w o l e n r p w t e t i g e m i e R d g i r e h t i p p , ) , e r e . P ) n i r i R o ( r ; w . s c ! r g n C s o n ) e v e v p a v o { X g o t ) ) v i r i o n i p . . n l a ; S e . e n v e s t t f i t { t w v w s a w . a a i n i a e i p e s e c r r g e o t r e o s I r a g g , n e C w r ) d C n e e ( ) o p t s o v t t f ) n o . , n a . . a ) { f r s f s v v l i t e p i W a a s { g . t ! r g o l l e , s F t e ) r u u ) e l h v ; l e e ; t t i i P d ) r R p s r . u o ( . o l { e t v n p a ) a i o s y v ; t e n . e i i w T c r e o e i a s w n r l n ) e ( C e v ) r v o d a C i n I s { o e f m W n w i a o f e g g r i r . e l g C f d d . o l M . y n i a c f p t a ! i ) c n = g ; h v = . ( a d p s v e r I i g e d e r v s w e P ) p e r ; o s o r ) p t ; s . . c n e o n n t T e i r l S e p d r I i m n a g g Y e . s t ) a ) r g { e t . v a l u e ) { With the above setting, when zooming using Mirador.actions.updateViewport, the zoom now respects constraints.
Summary# Ideally, it would be better to modify Mirador’s source code and rebuild it, but since I was unable to build Mirador successfully, I modified the pre-built files as an alternative approach.
I will continue investigating how to modify from the source code, but I hope this is helpful to others.