Open johnd0e opened 5 years ago
So now it's possible to improve the functions, and get better user experience. But because of mentioned inconsistency it would be better to replace these 2 functions with some new universal function, such as:
function selectPortal(guid, latlng, needSetView)
guid
, latlng
latlng
: L.Point or ArrayneedSetView
: booleanNote: May be renderDatails
action is also better if optional.
Obviously we can't just throw away old functions, so we keep them for compatibility.
IMHO better place such legacy functions in separate file compat.js
or legacy.js
.
Edit: consider also using these:
findPortalLatLng
(not used anywhere)
https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/portal_data.js#L56findPortalGuidByPositionE6
(used in uniques
plugin)
https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/portal_data.js#L100getPortalLinksCount
, getPortalFieldsCount
.
https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/portal_data.js#L24
https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/portal_data.js#L48zoomToAndShowPortal
:
selectPortalByLatLng
As a plugin dev. i've missed some function to load portal without moving the map, and to load portal without rendering details.
@angel93ayora How exactly are you going to use this function?
It will be useful in cases where you dont need/want to move the map or to load the details on the sidebar. Example: while drawing you want to check the status (if it is captured) of a portal or maybe its outgoing links
Example 2: you want to load only one portal without requesting all portals of an area
Should be used carefully, avoiding mass requests.
ok, its already done i have to update a plugin :)
ok, its already done
Well, that always was there). But now it's more convenient to use.
BTW, what is your plugin?
it's an opsec ENL plugin, if you are ENL i can share it with you
https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/utils_misc.js#L255-L263
https://github.com/IITC-CE/ingress-intel-total-conversion/blob/d77562b91a5b1e0bf170b4257eb33316a0b9daa3/code/utils_misc.js#L265-L284
Both functions are similar in action, and differs only by input parameters. So if both
guid
/latlng
are available then usezoomToAndShowPortal
, but if we have onlylatlng
then useselectPortalByLatLng
.Issues with both functions:
Map center set to
latlng
.map.panInside
.Map zoom set to 17. In most cases I'd prefer to keep current zoom if possible.
I suppose this is done in order to load portal details (which can be unavailable at the moment), and long time ago
17
was the value when portals of all levels get loaded.15
.zoomToAndShowPortal
we can useportalDetail.request
Functions are not consistent:
selectPortalByLatLng
set position/zoom only when portals details is not available yet.zoomToAndShowPortal
set position/zoom unconditionally.