|
@@ -357,27 +357,26 @@ export default {
|
|
|
},
|
|
|
initEvent() {
|
|
|
let lastHoveredFeature = null;
|
|
|
-
|
|
|
- function calculateHoverTop(mouseY, hoverHeight) {
|
|
|
- const windowHeight = window.innerHeight;
|
|
|
+ const calculateHoverTop = (mouseY, hoverHeight) => {
|
|
|
+ const componentHeight = this.$el.clientHeight;
|
|
|
const offset = 10;
|
|
|
- if (mouseY + hoverHeight + offset > windowHeight) {
|
|
|
+ if (mouseY + hoverHeight + offset > componentHeight) {
|
|
|
return mouseY - hoverHeight - offset;
|
|
|
}
|
|
|
return mouseY - hoverHeight / 2;
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
- function calculateHoverLeft(mouseX, hoverWidth) {
|
|
|
- const windowWidth = window.innerWidth;
|
|
|
+ const calculateHoverLeft = (mouseX, hoverWidth) => {
|
|
|
+ const componentWidth = this.$el.clientWidth;
|
|
|
const offset = 10;
|
|
|
- if (mouseX + hoverWidth + offset > windowWidth) {
|
|
|
+ if (mouseX + hoverWidth + offset > componentWidth) {
|
|
|
return mouseX - hoverWidth - offset;
|
|
|
}
|
|
|
if (mouseX - hoverWidth - offset < 0) {
|
|
|
return offset;
|
|
|
}
|
|
|
return mouseX + offset;
|
|
|
- }
|
|
|
+ };
|
|
|
this.map.on("pointermove", (evt) => {
|
|
|
const features = this.map.getFeaturesAtPixel(evt.pixel, {
|
|
|
hitTolerance: 1,
|