Skip to content

Commit

Permalink
Fix that data was not rendered when zoomed in too much (#5797)
Browse files Browse the repository at this point in the history
* fix that data was not rendered when zoomed in too much
* Merge branch 'master' of github.com:scalableminds/webknossos into fix-high-zoom
* Merge branch 'master' of github.com:scalableminds/webknossos into fix-high-zoom
* update changelog
  • Loading branch information
daniel-wer authored Nov 1, 2021
1 parent 45c2c8b commit 2c8f51e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed a bug where retried save requests could lead to a 409 CONFLICT error if the first request was already handled by the back-end. [#5779](https://github.com/scalableminds/webknossos/pull/5779).
- Fixed a bug where volume annotations could not be saved under certain circumstances (if "Render Missing Data Black" was disabled and a data bucket was annotated for the first time). [#5783](https://github.com/scalableminds/webknossos/pull/5783)
- Fixed a bug which made the ad-hoc mesh loading abort too early. [#5696](https://github.com/scalableminds/webknossos/pull/5696)
- Fixed that viewports turned black when zoomed in very much. [#5797](https://github.com/scalableminds/webknossos/pull/5797)

### Removed
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export function getRotationOrtho(planeId: OrthoView): Vector3 {
}
}

export type Area = { left: number, top: number, right: number, bottom: number };
export type Area = { left: number, top: number, right: number, bottom: number, isVisible: boolean };

function getArea(
rects: OrthoViewRects,
Expand All @@ -391,6 +391,8 @@ function getArea(
const uHalf = viewportWidthHalf * baseVoxelFactors[u];
const vHalf = viewportHeightHalf * baseVoxelFactors[v];

const isVisible = uHalf > 0 && vHalf > 0;

const left = Math.floor((position[u] - uHalf) / constants.BUCKET_WIDTH);
const top = Math.floor((position[v] - vHalf) / constants.BUCKET_WIDTH);
const right = Math.floor((position[u] + uHalf) / constants.BUCKET_WIDTH);
Expand All @@ -401,6 +403,7 @@ function getArea(
top,
right,
bottom,
isVisible,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ function addNecessaryBucketsToPriorityQueueOrthogonal(
let currentCount = 0;

for (const planeId of OrthoViewValuesWithoutTDView) {
// If the viewport is not visible, no buckets need to be added
if (!areas[planeId].isVisible) continue;

const [u, v, w] = Dimensions.getIndices(planeId);

const topLeftVector = [0, 0, 0, 0];
Expand All @@ -89,11 +92,6 @@ function addNecessaryBucketsToPriorityQueueOrthogonal(
bottomRightVector[v] = areas[planeId].bottom;
bottomRightVector[u] = areas[planeId].right;

const width = bottomRightVector[u] - topLeftVector[u];
const height = bottomRightVector[v] - topLeftVector[v];
// If the viewport is not visible, no buckets need to be added
if (width === 0 || height === 0) continue;

const scaledTopLeftVector = zoomedAddressToAnotherZoomStep(
topLeftVector,
resolutions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export class PrefetchStrategy extends AbstractPrefetchStrategy {
const fallbackPriorityWeight = isFallback ? 50 : 0;

for (const plane of OrthoViewValuesWithoutTDView) {
if (!areas[plane].isVisible) continue;

const [u, v, w] = Dimensions.getIndices(plane);
this.u = u;
this.v = v;
Expand Down

0 comments on commit 2c8f51e

Please sign in to comment.