From 71fd747051e14d77bc096dacf5019c70ed0b4701 Mon Sep 17 00:00:00 2001 From: Nelson Campos Date: Wed, 4 Apr 2018 11:31:18 +0100 Subject: [PATCH] Adds flip/mirror slides feature. This commit adds full support for a new OpenSeaDragon(OSD) feature - Mirror/Flip. In order to fully support this new feature, the following OSD objects had to be modified: - drawer.js: - navigator - openseadragon - strings - tiledImage - viewer Additionally, a new flip button was created (similar to the existing ones). Flip Logic Whenever the state is flip button is pressed, flip state is toogled, inverting all the controls and displays (the rotation direction is inverted as well). This means that all viewer coordinates (including user inputs) must me inverted too. Summary of modifications - drawer.js: modified _offsetForRotation to invert rotation angle on flipped state. Added a _flip method to scale/mirror canvas context. - navigator.js: adds full flip support and inverts nagivator inputs. - openseadragon.js: new buttons, flip state variable and showFlipControl variable. - strings.js: flip tool help tips. - tiledImage.js: flips the actual drawing canvas. - viewer.js: Added keyboardshortcuts to rotate 90degrees (r/R) and flip image (f/F). flip button state is stored here and flip order is set. The flipped state is stored on viewer object. --- images/flip_grouphover.png | Bin 0 -> 2179 bytes images/flip_hover.png | Bin 0 -> 2340 bytes images/flip_pressed.png | Bin 0 -> 2307 bytes images/flip_rest.png | Bin 0 -> 2300 bytes src/drawer.js | 25 ++++++++- src/navigator.js | 64 +++++++++++++++++++++-- src/openseadragon.js | 20 +++++++ src/strings.js | 3 +- src/tiledimage.js | 10 +++- src/viewer.js | 104 ++++++++++++++++++++++++++++++++----- src/viewport.js | 1 - 11 files changed, 205 insertions(+), 22 deletions(-) create mode 100644 images/flip_grouphover.png create mode 100644 images/flip_hover.png create mode 100644 images/flip_pressed.png create mode 100644 images/flip_rest.png diff --git a/images/flip_grouphover.png b/images/flip_grouphover.png new file mode 100644 index 0000000000000000000000000000000000000000..014ead6a384c9b97f041f1c9b0dcc3b52e5c5bc6 GIT binary patch literal 2179 zcmV-}2z>X6P)Qz*`b6OJA%YZMoQ<3G=ZQh0R<|;s;Uw~>Z)y3rLHQd()yw= zw!NLyzNvUWrcUdosVXfM1v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