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 that data was not rendered when zoomed in too much #5797

Merged
merged 4 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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