Skip to content

Commit

Permalink
v2.13.0 support top-down layering of overlapping masks
Browse files Browse the repository at this point in the history
  • Loading branch information
thejohnhoffer committed Mar 30, 2021
1 parent 8493ec1 commit ac8383a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build/bundle.js

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@ const changeSprings = function(viewer, seconds, stiffness) {
const newMarkers = function(tileSources, group, active_masks) {

const mask_paths = active_masks.map(m => m.Path);

Object.keys(tileSources)
.forEach(el => {
el === group.Path || mask_paths.includes(el)
? tileSources[el].forEach(t => t.setOpacity(1))
: tileSources[el].forEach(t => t.setOpacity(0));
})
const mask_path_index = mask_paths.indexOf(el);
const opacity = (el === group.Path || mask_path_index >=0) ? 1 : 0;
tileSources[el].forEach(tiledImage => {
tiledImage.setOpacity(opacity);
const {world} = tiledImage.viewer || {};
if (world && mask_path_index >= 0) {
// Reorder tiled images based on current active mask order
const itemIndex = world.getItemCount() - 1 - mask_path_index;
world.setItemIndex(tiledImage, Math.max(itemIndex, 0));
}
});
});
};

// Render openseadragon from given hash state
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build": "webpack --mode production"
},
"name": "minerva-browser",
"version": "2.12.0",
"version": "2.13.0",
"description": "A storytelling interface atop openseadragon",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit ac8383a

Please sign in to comment.