Commit Graph

210 Commits

Author SHA1 Message Date
superbland
11ef3fcfbb Add utility method for getting relative size 2021-10-09 16:25:53 +01:00
Alistair Buxton
e6725871b8 Make setFlip() update the navigator
Makes setFlip() raise a bounds change, and makes the navigator copy
the image flip in addition to the other properties, when receiving
the bounds signal.
2021-03-26 11:18:21 +00:00
Alistair Buxton
409620fa38 Tidy up the tile/image flip check
Don't need double negation and brackets here.
2021-03-23 02:26:06 +00:00
Alistair Buxton
7552806a47 Force reload tiles when the tile's flip doesn't match the image
Flipping an image changes the bounds of each tile. The existing
code assumes that cannot happen. getTile() calculates the tile
bounds the first time it is asked for a particular tile. It then
caches and returns the same time on every subsequent call.

getTile() has a check to test if a tile exists in the cache. If
it does not, the tile is created and inserted. In order to make
tiles be rebuilt after a flip, we only need to check if the tile's
flip matches the image's flip. If not, we can recreate the tile
as if it did not exist.

To make this a bit clearer, the tile's flipped flag is now set
in getTile() rather than positionTile().

This makes setFlip() work.
2021-03-22 06:45:26 +00:00
Alistair Buxton
3161808a9d Add a basic setFlip method to TiledImage
This doesn't fully work - even raising a bounds-change doesn't seem
to be enough.
2021-03-19 17:16:25 +00:00
Alistair Buxton
b2b95e8556 Correctly set the rightmost tile property when flipped
This ensures that seams are not visible in Firefox and Safari when
the image is wrapped horizontally and also flipped.
2021-03-19 14:49:07 +00:00
Alistair Buxton
3c57063632 Render the flipped columns in reverse order
This completes the per-image flip implementation. Tile bounds are
re-positioned within the image. When rendering, the x ordinals are
remapped to the flipped ones.

To use, set "flipped" on the image instead of the viewer. The code
is compatible with rotations and wrapping.

Implements #1553
2021-03-19 14:49:07 +00:00
Alistair Buxton
afa8c2d1bd Store the flipped state in each tile and render it as such
This will flip each individual tile on a per image bases. However
the tiles are now drawn in the wrong locations. Clipping etc works.
this is implemented for Canvas and HTML renderers.
2021-03-19 14:49:07 +00:00
Alistair Buxton
4b13cf32fd Introduce getTileBounds method for tiledImage
This wraps the implementation in tileSource but provides support for
wrapping. It does not support getting the source bounds.

Using this function instead of the tileSource version allows the
viewport clipping optimization to work with wrapping.
2021-03-19 14:49:07 +00:00
Mark Salsbery
c4351f64e8 stricter linting 2020-06-25 16:01:14 -07:00
Kenan Christian Dimas
c20f95ba94
small doc fix 2020-05-12 23:37:37 +07:00
Takuma Kira
9998edb255 Move TileSource.destroy to the right place. 2020-04-17 14:29:19 +09:00
Ian Gilman
4c64042bac JSDoc fixes 2020-03-05 10:29:08 -08:00
Jasper Staab
0c2c506d88 apply pixelDensityRatio after flip 2020-02-19 18:35:23 -10:00
YSH
4627d59609
Update tiledimage.js 2020-02-13 14:49:14 -08:00
zero41120
3ec9b66bc9 1540 Use OSD defined isArray 2020-02-11 11:34:53 -08:00
YSH
d8651bd268
1540 Update documentation with correct terminology 2020-02-11 11:30:37 -08:00
zero41120
ff70878bb9 1540 Update documentation for setCroppingPolygons 2020-02-10 16:19:09 -08:00
zero41120
9d0c7bd9c9 1540 Remove support for array for cropping 2020-02-10 16:16:19 -08:00
Yansong Hong
7193f5b445 1540 Add support for xy point object and mixed array 2020-02-07 16:03:40 -08:00
zero41120
2d971af445 1540 Add feature to crop tiledImage with multiple polygons 2020-02-06 13:46:14 -08:00
Ian Gilman
c01887f3e3 Updated NPM packages 2019-12-30 10:46:44 -08:00
Nelson Campos
dc8331e641 Clean unnecessary code.
Clean tiled image's flip property and methods.
2018-10-19 15:49:27 +01:00
Nelson Campos
2670f62892 Fix navigator flip transformation
Flip transformation wasn't correctly applied on navigator for all images when its tileSource is flipped by default.
2018-10-18 12:04:52 +01:00
Nelson Campos
132c68c8bb Create getFlip function to retrieve tiledImage flipped state 2018-10-17 12:45:10 +01:00
Nelson Campos
cf20d9fb43 Fix drawer clearance bounds 2018-10-16 17:29:44 +01:00
Nelson Campos
7a7ba07902 Moved flip call to the end of drawTiles method. Just code backup 2018-10-02 16:57:31 +01:00
Nelson Campos
49e3ef6885 Code backup. Bug Semi-fix. 2018-10-01 17:03:34 +01:00
Ian Gilman
071b865765 Tweaks to minLevel DZI patch 2018-07-06 13:17:46 -07:00
Ian Gilman
452e50c8d8 Making the DziTileSource honor minLevel. 2018-07-03 09:40:10 -07:00
Alan Aberdeen
002c1fcc65 Add documentation for .source on TiledImage 2018-06-13 20:11:26 +01:00
Nelson Campos
7e5c9e1897 Changes flip store object from viewer to viewport.
More than changing the store object of flip state, the code was simplified and the onFlip function from openseadragon was changed to receive a viewer argument.
TiledImage had a flipped variable wrongly stored.

From now on, flipped state must be read from the viewport object.
2018-04-10 11:51:06 +01:00
Nelson Campos
f65dbd3a39 Changes back showFlipControl and showNavigator variables to false default state 2018-04-09 15:06:29 +01:00
Nelson Campos
6e4012976b Adds two helpers for style formating and updates onCanvasKeyPress method.
There were created a new helper method "setDisplayTransform" to change navigator styling.
Also, a new general function "setElementTransform" was created to help on element styling.

For this commit, I also made some changes on viewer onCanvasKeyPress method:
- r is rotating the image clockwise;
- R is rotating the image counter clockwise;
- Freed "F" keycode to other purposes (like filters or others).
2018-04-06 11:52:10 +01:00
Nelson Campos
71fd747051 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.
2018-04-04 16:08:13 +01:00
Ian Gilman
075a37ce8c Now supporting square edge tiles with padding 2018-03-21 14:07:00 -07:00
Rob Hicks
d59e237dda more doc tweaks 2017-10-25 14:55:28 -06:00
Rob Hicks
12e1869f99 add clarifications to api docs for TiledImage 2017-10-25 14:51:17 -06:00
Peter
44b108f00e changed conditional if to else in draw function 2017-10-05 14:44:56 -04:00
Peter
f64388b038 Solves issue #1318 : transparent tiledImages get _needsDraw = false in the draw function. 2017-10-04 16:11:08 -04:00
Ian Gilman
a49bbbcb06 Addressing seams that appear in wrap mode on Safari and Firefox 2017-09-08 14:03:40 -07:00
Mutlu Koesem
8a4ef0cc2e Fix placeholderFillStyle on tiledImage has no effect 2017-08-09 11:39:17 +02:00
Ian Gilman
ca4550d76e Doc comment fixes 2017-07-18 16:22:26 -07:00
Ian Gilman
d2c58c43aa Removed Boolean constructor from pre-load patch 2017-07-13 16:56:09 -07:00
Ian Gilman
e8971b2940 Merge branch 'master' of https://github.com/thejohnhoffer/openseadragon into thejohnhoffer-master 2017-07-13 16:53:43 -07:00
Ian Gilman
6600aca3e4 Removing debug code 2017-07-11 13:41:40 -07:00
Ian Gilman
2419a0111a Merge branch 'master' into ig-loading 2017-07-06 10:06:07 -07:00
Sean Nichols
e4393cc4dc Use TileSource.getClosestLevel to set TileCache release cutoff 2017-06-06 15:30:14 -04:00
Ian Gilman
8d782e1003 Merge branch 'master' into ig-loading 2017-05-31 10:00:46 -07:00
Sean Nichols
1fb25f3e41 Add documentation for opacity-change and composite-operation-change
- Add early exit to setOpacity/setCompositeOperation when new value is
   the same as current
2017-05-30 14:52:45 -04:00