-
Notifications
You must be signed in to change notification settings - Fork 24
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 rendering if 3D viewport is hidden initially #5429
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,21 +134,18 @@ class PlaneController extends React.PureComponent<Props> { | |
// catchers (only necessary for HammerJS). We should refactor the | ||
// InputMouse handling so that this is not necessary anymore. | ||
// See: https://github.com/scalableminds/webknossos/issues/3475 | ||
const tdId = `inputcatcher_${OrthoViews.TDView}`; | ||
Utils.waitForElementWithId(tdId).then(() => { | ||
OrthoViewValuesWithoutTDView.forEach(id => { | ||
const inputcatcherId = `inputcatcher_${OrthoViews[id]}`; | ||
Utils.waitForElementWithId(inputcatcherId).then(el => { | ||
if (!document.body.contains(el)) { | ||
console.error("el is not attached anymore"); | ||
} | ||
this.input.mouseControllers[id] = new InputMouse( | ||
inputcatcherId, | ||
this.getPlaneMouseControls(id), | ||
id, | ||
true, | ||
); | ||
}); | ||
OrthoViewValuesWithoutTDView.forEach(id => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Waiting for the 3d viewport did not succeed here, if it's hidden initially. In that case, the mouse handlers were not set up. Since, there is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this won't be a problem, as the Note:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point! I cross-referenced this comment in the corresponding issue: #3475 I agree that this is out-of-scope for this PR. |
||
const inputcatcherId = `inputcatcher_${OrthoViews[id]}`; | ||
Utils.waitForElementWithId(inputcatcherId).then(el => { | ||
if (!document.body.contains(el)) { | ||
console.error("el is not attached anymore"); | ||
} | ||
this.input.mouseControllers[id] = new InputMouse( | ||
inputcatcherId, | ||
this.getPlaneMouseControls(id), | ||
id, | ||
true, | ||
); | ||
}); | ||
}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By postponing this null-check to the exact points where it's necessary (i.e., in
setTargetAndFixPosition
), we can eagerly instantiate the CameraController which should fix the issue.