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

added onMouseMove callback #1127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 25 additions & 22 deletions src/google_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ const _checkMinZoom = (zoom, minZoom) => {
if (zoom < minZoom) {
console.warn(
'GoogleMap: ' + // eslint-disable-line
'minZoom option is less than recommended ' +
'minZoom option for your map sizes.\n' +
'overrided to value ' +
minZoom
'minZoom option is less than recommended ' +
'minZoom option for your map sizes.\n' +
'overrided to value ' +
minZoom
);
}
}
Expand Down Expand Up @@ -150,7 +150,7 @@ class GoogleMap extends Component {
distanceToMouse(pt, mousePos /* , markerProps */) {
return Math.sqrt(
(pt.x - mousePos.x) * (pt.x - mousePos.x) +
(pt.y - mousePos.y) * (pt.y - mousePos.y)
(pt.y - mousePos.y) * (pt.y - mousePos.y)
);
},
hoverDistance: 30,
Expand Down Expand Up @@ -213,16 +213,16 @@ class GoogleMap extends Component {
if (this.props.apiKey) {
console.warn(
'GoogleMap: ' + // eslint-disable-line no-console
'apiKey is deprecated, use ' +
'bootstrapURLKeys={{key: YOUR_API_KEY}} instead.'
'apiKey is deprecated, use ' +
'bootstrapURLKeys={{key: YOUR_API_KEY}} instead.'
);
}

if (this.props.onBoundsChange) {
console.warn(
'GoogleMap: ' + // eslint-disable-line no-console
'onBoundsChange is deprecated, use ' +
'onChange({center, zoom, bounds, ...other}) instead.'
'onBoundsChange is deprecated, use ' +
'onChange({center, zoom, bounds, ...other}) instead.'
);
}

Expand Down Expand Up @@ -344,12 +344,12 @@ class GoogleMap extends Component {
if (
!prevCenter ||
Math.abs(currentCenter.lat - prevCenter.lat) +
Math.abs(currentCenter.lng - prevCenter.lng) >
kEPS
Math.abs(currentCenter.lng - prevCenter.lng) >
kEPS
) {
if (
Math.abs(currentCenter.lat - centerLatLng.lat) +
Math.abs(currentCenter.lng - centerLatLng.lng) >
Math.abs(currentCenter.lng - centerLatLng.lng) >
kEPS
) {
this.map_.panTo({
Expand Down Expand Up @@ -849,10 +849,10 @@ class GoogleMap extends Component {
) {
console.warn(
'GoogleMap: ' + // eslint-disable-line
'Usage of internal api objects is dangerous ' +
'and can cause a lot of issues.\n' +
'To hide this warning add yesIWantToUseGoogleMapApiInternals={true} ' +
'to <GoogleMap instance'
'Usage of internal api objects is dangerous ' +
'and can cause a lot of issues.\n' +
'To hide this warning add yesIWantToUseGoogleMapApiInternals={true} ' +
'to <GoogleMap instance'
);
}

Expand Down Expand Up @@ -970,6 +970,9 @@ class GoogleMap extends Component {
this.mouse_.lat = latLng.lat;
this.mouse_.lng = latLng.lng;

if (this.props.onMouseMove != undefined) {
this.props.onMouseMove(this.mouse_);
}
this._onChildMouseMove();

if (currTime - this.dragTime_ < K_IDLE_TIMEOUT) {
Expand Down Expand Up @@ -1115,13 +1118,13 @@ class GoogleMap extends Component {

size: this.geoService_.hasSize()
? {
width: this.geoService_.getWidth(),
height: this.geoService_.getHeight(),
}
width: this.geoService_.getWidth(),
height: this.geoService_.getHeight(),
}
: {
width: 0,
height: 0,
},
width: 0,
height: 0,
},
});
}

Expand Down