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
marker addTo ->ERROR TypeError: this._offset.mult is not a function #13145
Comments
It's impossible to tell without knowing more about your codebase or having a reproducible example. Does the marker call |
What changed between 2.7 and 2.14?Did something change in how markers are added?I may be adding the marker then positioning it. Im not in front of the code right now. I can look more into it this afternoon. But the same line of code works in 2.7 and fails in versions after that. Should the update function be checking that position is set before scaling via mult?Sent from my iPhoneOn Apr 12, 2024, at 7:02 AM, Volodymyr Agafonkin ***@***.***> wrote:
What reasons would this._offset be null/undefined? or not have the expected mult function?
It's impossible to tell without knowing more about your codebase or having a reproducible example. Does the marker call setOffset at any point, possibly passing a nullish value?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I found the issue: version 2.7 marker.js:
Note: It is establishing a new point if one is not set However, that is not happening in the newer versions hence the problem
My problem is that I need the advancements in 3.* but this is impeding me from being able to upgrade. |
I have done a deeper exploration of the issue.
For some reason, even though the older versions defined PointLIke as either Point or [number,number] the above worked. In reviewing older and newer versions I don't know that ever should have worked with a non Point object or array. This resulted in _updateDOM seeing this._pos as being an object like {x:0,y:0} and not a Point geometry object with mult as a function. At this juncture I can only guess that Point.convert recieving {x:0,y:0} used to returned some falsy value. Should there be another aspect of PointLIke that supports a simpler type like
Then Point.convert would need to know to check for Point as a type, an array, or Point Coord and if PointCoord return either a Point or 3DPoint object? |
For a line of code that worked in version 2.* which is attempting to add a Marker to the map using addTo
"this.queryMarker.addTo(this.map.ui);"
where this.queryMarker is a Marker
and this.map.ui is a mapbox-gl Map instance
I am getting an error:
ERROR TypeError: this._offset.mult is not a function
at aI._updateDOM (mapbox-gl.js:33:808684)
at mapbox-gl.js:33:810271
at Map._requestDomTask (mapbox-gl.js:33:843059)
at aI._update (mapbox-gl.js:33:810216)
at aI.addTo (mapbox-gl.js:33:805410)
mapbox-gl-js version:
3.*
2.14.0
Seems to happen after version 2.7.0 where the addTo command worked.
browser:
Chrome
Steps to Trigger Behavior
I have not confirmed the error in a simpler setup, but the line of code shared above has worked for a couple years and suddenly isn't.
Link to Demonstration
not presently possible
I appreciate the virtue of having a discrete test setup.
However, the offending code exists once and should be easy for an IDE to find, just look for this._offset._mult
"_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale); ..."
What reasons would this._offset be null/undefined? or not have the expected mult function?
Expected Behavior
I expect a marker to be added to the map without error
Actual Behavior
I get an error about this._mult not being a function.
The text was updated successfully, but these errors were encountered: