Describe the bug π
I noticed that if you zoom out to say 80% on the browser the click upon the model does not hit correctly.
This version did not have this problem
"@thatopen/components": "^3.3.0",
"@thatopen/components-front": "^3.3.0",
"@thatopen/fragments": "^3.3.6",
"@thatopen/ui": "^3.3.0",
"@thatopen/ui-obc": "^3.3.0",
but in this version
"@thatopen/components": "3.4.5",
"@thatopen/components-front": "3.4.3",
"@thatopen/fragments": "3.4.5",
"@thatopen/ui": "3.4.1",
"@thatopen/ui-obc": "3.4.2",
it is a problem.
I worked around it by
const simpleRenderer = new OBC.SimpleRenderer(components, containerElement);
this.applyPixelRatio(simpleRenderer);
this.watchPixelRatioChanges(simpleRenderer);
world.renderer = simpleRenderer;
private applyPixelRatio(simpleRenderer: OBC.SimpleRenderer): void {
const renderer = simpleRenderer.three;
if (!renderer?.setPixelRatio) return;
const dpr = Math.max(1, Math.min(window.devicePixelRatio || 1, 2));
if (renderer.getPixelRatio() !== dpr) {
renderer.setPixelRatio(dpr);
}
}
private watchPixelRatioChanges(simpleRenderer: OBC.SimpleRenderer): void {
if (this._dprMediaQuery) return;
const handler = () => this.handlePixelRatioChange(simpleRenderer);
const attach = () => {
const dpr = window.devicePixelRatio || 1;
const mql = window.matchMedia(`(resolution: ${dpr}dppx)`);
this._dprMediaQuery = mql;
this._dprMediaQueryHandler = () => {
handler();
attach();
};
mql.addEventListener('change', this._dprMediaQueryHandler);
};
attach();
}
Ask if any questions :-)
Reproduction βΆοΈ
No response
Steps to reproduce π’
No response
System Info π»
chrome
_"@thatopen/components": "3.4.5",
"@thatopen/components-front": "3.4.3",
"@thatopen/fragments": "3.4.5",
"@thatopen/ui": "3.4.1",
"@thatopen/ui-obc": "3.4.2",_
Used Package Manager π¦
npm
Error Trace/Logs π
No response
Validations β
Describe the bug π
I noticed that if you zoom out to say 80% on the browser the click upon the model does not hit correctly.
This version did not have this problem
"@thatopen/components": "^3.3.0",
"@thatopen/components-front": "^3.3.0",
"@thatopen/fragments": "^3.3.6",
"@thatopen/ui": "^3.3.0",
"@thatopen/ui-obc": "^3.3.0",
but in this version
"@thatopen/components": "3.4.5",
"@thatopen/components-front": "3.4.3",
"@thatopen/fragments": "3.4.5",
"@thatopen/ui": "3.4.1",
"@thatopen/ui-obc": "3.4.2",
it is a problem.
I worked around it by
Ask if any questions :-)
ReproductionβΆοΈ
No response
Steps to reproduce π’
No response
System Info π»
Used Package Manager π¦
npm
Error Trace/Logs π
No response
Validations β