Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in fallback rendering when layer has missing mags #7082

Merged
merged 4 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed the datasource-properties.json route for zarr-streaminge export of datasets that are not wkw/zarr. [#7065](https://github.com/scalableminds/webknossos/pull/7065)
- Fixed an issue where you could no longer invite users to your organization even though you had space left. [#7078](https://github.com/scalableminds/webknossos/pull/7078)
- Fixed displayed units of used storage in the organization's overview page. [#7057](https://github.com/scalableminds/webknossos/pull/7057)
- Fixed a rendering bug that could occur when a dataset layer has missing mags (e.g., the first mag is 8-8-8). [#7082](https://github.com/scalableminds/webknossos/pull/7082)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,20 @@ class PlaneMaterialFactory {
let representativeMagForVertexAlignment: Vector3 = [Infinity, Infinity, Infinity];
for (const [layerName, activeMagIndex] of Object.entries(activeMagIndices)) {
const layer = getLayerByName(Store.getState().dataset, layerName);
const activeMag = getResolutionInfo(layer.resolutions).getResolutionByIndex(
activeMagIndex,
);
const resolutionInfo = getResolutionInfo(layer.resolutions);
// If the active mag doesn't exist, a fallback mag is likely rendered. Use that
// to determine a representative mag.
const suitableMagIndex = resolutionInfo.getIndexOrClosestHigherIndex(activeMagIndex);
const suitableMag =
suitableMagIndex != null
? resolutionInfo.getResolutionByIndex(suitableMagIndex)
: null;

const hasTransform = !_.isEqual(getTransformsForLayer(layer), Identity4x4);
if (!hasTransform && activeMag) {
if (!hasTransform && suitableMag) {
representativeMagForVertexAlignment = V3.min(
representativeMagForVertexAlignment,
activeMag,
suitableMag,
);
}
}
Expand Down