Overview

I needed to change the zoom, scale, and rotation behavior of Mirador 4, so this is a memo on how to make those changes.

Setup

Start Mirador 4 locally with the following commands.

gcppidnntppmmmcilrisoatndaeorrthttps://github.com/projectmirador/mirador

It starts on port 4444.

Customizing the zoomIn Processing

As an example, let’s modify the processing when the zoomIn button is clicked as follows.

h a n }d lcu/}eop/)Zndzrxy;osazoo::ottootmeomavvI{Vm:tiini:ieeCwevowwliwvineeinpie:rrcdoew..korwevxy(wteri)I(r.edw.zw{,izoe11noor..udom.11pomr,,dwoaIttd1ae,2.tV,1iaai{,oddenddweep+ddora5td,,devdieawdedred}=this.props;

As a result, when pressing the zoomIn button, you can see that zoom and rotation occur while the center shifts slightly.

https://youtu.be/wn1WxpTVpS4

By applying this approach, you can customize the zoom, scale, rotation, and other behaviors of Mirador 3.

Setting the immediately Property

In the above example, it took a bit of time for zoom and rotation to complete. To perform these operations instantly, customize the componentDidUpdate in OpenSeadragonViewer.js as follows.

This allows configuring whether zoom and rotation should be performed immediately based on the immediately property of the viewerConfig object.

com}poc}cti}i)}}}noohffenvc=nii}tr{vctetecci}i}i}i}nsiass(fheiohlhlooffffttentt.pvvvvit!enisisnnvvvDwvhariiiisut!wssesessiiiii{eai{peveeee.rhtet..ttvevevevedrssiviwwwwanihrairiivwiwiwiwUCW.vRSeeeeed;si.cdfef{ieipepepeppoopietwrrrrd.scadfmweowowowodnrrefae..CCAi.lnA(rvmewrerereraflow.trvvoolnnovl!evieretrtrtrttidpeceCiinnlfosalisiedCr.C.C.C.eg,sru.oeeffIonesIshewioCpozosos(,;rvnwwiimRT(emETwpanoanonenep}rifppggaei)saqieotfnnfoftftreeioo..gsl;CgulrreifTimiRiFe=nwgrrdfepeheaeCtlgiogTgoglvte)ttelSodaSlPoy.g(.o.t.iPtr..gionIno(rn}x.vz(rafprh={pzrpusmgucof=yiovotl(oi=aoereaerapi=!eoitiivpsv=noe!csgdcnegv=!wmeaopis.i=Tms=eMeevrvi==ewtne,seoT=sad=sat&ie=r!ei(!wtwu(o!(tM(si&ewvC=rov=epaenv(=u!ca!(Weweivo=Cni=rrtrdiv=n(ht(cos!ereinoeCee;eeidv(ciar(trCwefvn!wvov;fweueiphsnl)h;opwiif=einSiewnfer(Evd;inopgei=reftnrediwepqa.sfro,wgCwiaeCrenevrusl.itrp.vopgtdoCferPeaeaog.tiozino.e)noidCrvlsys.c.mroefrf)fnnooP(Cediecmtowitl{ife&nprchrUmnee.mpg.i{gid&fsoaaspmtndz,o.gp,gi.pnn,deetiorre).&vgisvgadreaovtot;tz&i)n.aeptiSrtmi.tFroe)fnsdriapSeSegaluovw;ooWentrplpwetiemieRngeiryretip),ereTrP)lni)irRo(;w.silrygn;nCon)vevpld!o{Xggot,)irioe.vp.Y.nae.endcist.tfti{wvwsIae.ataiimeipemnwcfrargomreosaveaagrg,neCwr)garnlege(doptesCvsteti)ino.sIoae.t.m)afrs)dns;v.vmtitesfWavae{eg.t,iolaldl,sFgruluiyelp)leuea)ttir)de)t;rRpe;.)euo(vl{letvPa{y)airy);teoe;iwproessnr.)(Cc)voainn{efvwiaegsr.WCfoolrnilfpdi).g;c.adnevgarseIedss)););

Then, add immediately: true to the earlier ZoomControls.js.

h a n }d lcu/}eop/)Zndzrxyi;osazoo::mottootmmeomavveI{Vm:tiidni:ieeiCwevowwaliwvineetinpie:rrecdoew..lkorwevxyy(wteri:)I(r.edw.zwt{,izoe11rnoor..uudom.11epomr,,,dwoaIttd1ae,2.tV,1iai{,odendwep+dor5t,,viewer}=this.props;

The result is the following behavior.

https://youtu.be/qfGo-WCQZoQ

Compared to the previous behavior, zoom and rotation are now performed immediately.

Why Instant Zoom and Rotation is Needed

I am currently developing a plugin that synchronizes zoom, scale, and rotation operations across multiple windows.

During this development, there were cases where synchronization did not work properly unless zoom, scale, and rotation operations were performed immediately.

There may be aspects that were not fully considered in this modification, but I hope to submit a pull request eventually.

Summary

We hope this serves as a useful reference for Mirador 4 plugin development.