From eebfdc139135ec3ead2387059794d7732b856482 Mon Sep 17 00:00:00 2001 From: Alistair Buxton Date: Tue, 23 Mar 2021 03:12:58 +0000 Subject: [PATCH] Improve the flipping example Adds tiled images to the viewer at creation so that they are properly centred. This also checks the current state of the test checkboxes on loading. Some browsers, notably Firefox, will remember the value of checkboxes across reloads. This can lead to the checkboxes being out of sync with with viewer after a reload. An alternative is to set autocomplete="off" on each checkbox element. This will force the browser to reset the field to the default specified in the HTML. However I think checking the actual value is preferable as it means the defaults are only specified in one place. --- test/demo/flipping.html | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/test/demo/flipping.html b/test/demo/flipping.html index f31b8ebc..3d3eb99e 100644 --- a/test/demo/flipping.html +++ b/test/demo/flipping.html @@ -20,8 +20,6 @@ margin: 0.3em; } - - @@ -57,6 +55,7 @@
+ Viewport
@@ -73,21 +72,25 @@ // debugMode: true, id: "contentDiv", prefixUrl: "../../build/openseadragon/images/", - showNavigator:true + showNavigator:true, + tileSources: [ + { + tileSource: "../data/testpattern.dzi", + x: 0, + y: 0, + flipped: document.getElementById("ffirst").checked, + degrees: document.getElementById("rfirst").checked * 45, + }, { + tileSource: "../data/testpattern.dzi", + x: 1, + y: 0, + flipped: document.getElementById("fsecond").checked, + degrees: document.getElementById("rsecond").checked * 45, + } + ] }); - var first = viewer.addTiledImage({ - tileSource: "../data/testpattern.dzi", - x: 0, - y: 0, - }); - - var second = viewer.addTiledImage({ - tileSource: "../data/testpattern.dzi", - x: 1, - y: 0, - flipped: true, - }); + viewer.viewport.setFlip(document.getElementById("fview").checked); function debug(v) { viewer.setDebugMode(v);