Closed johnd0e closed 4 years ago
Now padding can be specified using option
renderer: L.canvas({ padding: 0.5 }),
It would be useful to specify a large padding if portals were reloaded while the map was being moved, rather than after releasing the mouse.
But now increase of padding is confusing.
Previously our padding varied, and actually (in case of canvas) was decreased too.
There was some comment about performance.
But now increase of padding is confusing.
Why?
This code was added to this commit: https://github.com/iitc-project/ingress-intel-total-conversion/commit/69f3fb211b2c8b8d511743f1c151803bc34e6830
If I understood correctly, SVG is drawn by browser only inside the visible party of window. This allows to specify padding as 100%.
I tried to make a padding 100% and it's confusing. It's hard to know where the edge of downloaded portals is to wait for new portals to load.
This seems to be the subject of separate issue, but I want to load portals at the same time as moving map.
tried to make a padding 100% and it's confusing. It's hard to know where the edge of downloaded portals is to wait for new portals to load.
It's implied that when we have 100% overclip — we rarely need to wait portals to load, as it occurs in background.
I don't know what is true, but from mentioned commit message I conclude that large overclip was intended to keep already loaded entities on map (do not remove them when they appear offscreen, in case if we may need to pan back).
And it's interesting why so low padding value for canvas mode (0.02)... May be at that time canvas was slower them SVG? Or it was too buggy?
This seems to be the subject of separate issue, but I want to load portals at the same time as moving map.
Well, loading delay is intentional, to lower ingress servers usage. I can be wrong (haven't yet studied that part of code), but it seems that current data refreshing algorithm is not optimized, and even for small movement can initiate full map refresh. And you are right, it is worth separate issue.
Edit: full refresh also can be intentional, to keep visible map in consistent state.
Returning to our subject: I will prepare PR for padding. As for optimal value I suppose we need more experiment to find it empirically.
Now padding 0.1 (10%) by default, why not
As for optimal value I suppose we need more experiment to find it empirically.
Well, I've tried: https://github.com/johnd0e/ingress-intel-total-conversion/commit/f87d2d6d8659eda85046fef9e0972c0c6bfda088
But I do not see any difference, even after setting window.PADDING
to 1
.
What am I doing wrong?
It will work, but
note: before i set window.PADDING
as 1.
L.Renderer.mergeOptions({
padding: window.PADDING
});
it only changes padding
for a regular map.
need to add also
L.Layer.mergeOptions({
padding: window.PADDING
});
padding: 0.1
from options
in CanvasIconLayer
.need change from 0.1
to self.options.padding
now all ok
But Map does not extend the Renderer, I do not know how set padding
option on Renderer changes padding
on Map.
But Map does not extend the Renderer, I do not know how set
padding
option on Renderer changespadding
on Map.
We just need to do it manually. I will, as soon as I understand how padding should work in general.
need change from
0.1
toself.options.padding
Done in feature branch (in other places I will update later).
need to add also
L.Layer.mergeOptions({ padding: window.PADDING });
Thanks, I will try now (thought It looks weird - why change it in two places separately).
But I do not see any difference, even after setting
window.PADDING
to1
. What am I doing wrong?
It seems I was doing right.
need to add also
L.Layer.mergeOptions({ padding: window.PADDING });
I do not think so.
E.g. evaluate in console: portals[selectedPortal]._renderer.options.padding
But Map does not extend the Renderer, I do not know how set
padding
option on Renderer changespadding
on Map.
We have here several alternatives:
onAdd
to map (get from map.getRenderer().options
)initialize
(inherit from L.Canvas.prototype.options.padding
)padding
earlier, before including leaflet.canvas-markers.js
padding
option is overridden earlier)Update I've chosen last option.
It's hard to know where the edge of downloaded portals is to wait for new portals to load.
In padding area iitc draws only that features, that are currently (partly) displaying in screen boundaries. That includes links, fields, and corresponding placeholder portals.
If it seems confusing... Well, we already have requests progress indicator in bottom right corner. May be we should make it bigger, like in stock intel.
I'd prefer to load data when moving map. Just like it's done for tiles of map layer
I'd prefer to load data when moving map. Just like it's done for tiles of map layer
And now it is done exactly like that (other is proposed only in #204). So look what I mean:
We have old code changing
L.Path.CLIP_PADDING
, but this property is not used in current Leaflet, there is Renderer optionpadding
instead.Question: should we ever change defaults?