|
@@ -791,15 +791,15 @@ export function uwbMain(domId, modelWidth, modelHeight, finalMode, callback) {
|
|
let mouse = new THREE.Vector2();
|
|
let mouse = new THREE.Vector2();
|
|
let raycaster = new THREE.Raycaster();
|
|
let raycaster = new THREE.Raycaster();
|
|
let housePlayer = document.getElementById('house-player');
|
|
let housePlayer = document.getElementById('house-player');
|
|
|
|
+ let marginLeft = 0;
|
|
|
|
+ let marginTop = 0;
|
|
if (housePlayer) {
|
|
if (housePlayer) {
|
|
let mapDom = document.getElementsByClassName("ordinary-map-container")[0];
|
|
let mapDom = document.getElementsByClassName("ordinary-map-container")[0];
|
|
let style = getComputedStyle(mapDom);
|
|
let style = getComputedStyle(mapDom);
|
|
let width = parseFloat(style.width);
|
|
let width = parseFloat(style.width);
|
|
let height = parseFloat(style.height);
|
|
let height = parseFloat(style.height);
|
|
- let marginLeft = (width - (width * 1.8)) / 2;
|
|
|
|
- let marginTop = (height - (height * 1.8)) / 2;
|
|
|
|
- let allWidth = parseFloat(housePlayer.style.width) + Math.abs(marginLeft);
|
|
|
|
- let allHeight = parseFloat(housePlayer.style.height) + Math.abs(marginTop);
|
|
|
|
|
|
+ marginLeft = (width - (width * 1.8)) / 2;
|
|
|
|
+ marginTop = (height - (height * 1.8)) / 2;
|
|
|
|
|
|
mouse.x = ((event.clientX + Math.abs(marginLeft)) / parseFloat(housePlayer.style.width)) * 2 - 1;
|
|
mouse.x = ((event.clientX + Math.abs(marginLeft)) / parseFloat(housePlayer.style.width)) * 2 - 1;
|
|
mouse.y = -((event.clientY + Math.abs(marginTop)) / parseFloat(housePlayer.style.height)) * 2 + 1;
|
|
mouse.y = -((event.clientY + Math.abs(marginTop)) / parseFloat(housePlayer.style.height)) * 2 + 1;
|
|
@@ -821,15 +821,15 @@ export function uwbMain(domId, modelWidth, modelHeight, finalMode, callback) {
|
|
console.log('===== bench selected =====')
|
|
console.log('===== bench selected =====')
|
|
window.store.dispatch('benchList/setMouseOverBench', {
|
|
window.store.dispatch('benchList/setMouseOverBench', {
|
|
bench_id: m.object.userData.benchId,
|
|
bench_id: m.object.userData.benchId,
|
|
- pageX: event.x,
|
|
|
|
- pageY: event.y,
|
|
|
|
|
|
+ pageX: event.x + Math.abs(marginLeft),
|
|
|
|
+ pageY: event.y + Math.abs(marginTop),
|
|
status: true
|
|
status: true
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
window.store.dispatch('benchList/setMouseOverBench', {
|
|
window.store.dispatch('benchList/setMouseOverBench', {
|
|
bench_id: m.object.userData.benchId,
|
|
bench_id: m.object.userData.benchId,
|
|
- pageX: event.x,
|
|
|
|
- pageY: event.y,
|
|
|
|
|
|
+ pageX: event.x + Math.abs(marginLeft),
|
|
|
|
+ pageY: event.y + Math.abs(marginTop),
|
|
status: false
|
|
status: false
|
|
})
|
|
})
|
|
}
|
|
}
|