-
Notifications
You must be signed in to change notification settings - Fork 4
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
Changes for IITC #1
Conversation
* leaflet.canvas-markers.js: - include source IITC-CE/Leaflet.Canvas-Markers@e0bc449 IITC-CE/Leaflet.Canvas-Markers#1 (IITC-CE/Leaflet.Canvas-Markers@e0bc449) * rbush.min.js - required by leaflet.canvas-markers.js https://unpkg.com/[email protected]/rbush.min.js
Nice job! |
Maybe you'll be able to finish options.padding support. Ornaments are constantly shifting: either by moving the map or changing the screen size |
We need padding to solve this, or this issue caused by unfinished padding support? |
It's not ready. Maybe I should have sent it to a separate branch. |
As this feature is not blocker it makes sense to put it separate branch. And tell me more about 419b1ab: what is 'atypical use'? |
I was able to fix it. Padding works correctly.
Our code tries to remove those markers which may not exist. That's why I added additional checks to correct the errors. |
Great! |
// e.g. 0.1 would be 10% of map view in each direction | ||
padding: 0.1 | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we inherit this value from map renderer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Leaflet padding
value is specified in Renderer
class (var Renderer = Layer.extend({
) and is not overridden.
It would be useful to assign an indent equal to that in window.map
in iitc, but this is hardly possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to assign an indent equal to that in window.map in iitc, but this is hardly possible.
Why hardly? I suppose we just need map._renderer.options.padding
.
Or map.getRenderer({options:{}}).options.padding
.
Then in our boot.js
we can do like this:
L.CanvasIconLayer.mergeOptions({
padding: map._renderer.options.padding`
});
src/plugin/leaflet.canvas-markers.js
Outdated
@@ -24,7 +24,8 @@ function layerFactory(L) { | |||
this._draw(); | |||
}, | |||
onRemove: function () { | |||
this._destroyContainer(); | |||
// TODO | |||
// this._destroyContainer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this._destroyContainer() is unique to this plugin and redundant
Currently L.CanvasMarkerLayer
has dual nature:
L.Layer
, from which it's inherited initially.- And after Spaction@153525e it has some features of
L.Renderer
(but still is not inherited from it)
I can guess that mentioned commit was just a step to make true renderer which can be used transparently (#2).
But in it's current (perhaps unfinished) state L.CanvasMarkerLayer
is rather layer, so it should'n destroy it's container on remove.
I wonder if we've chosen right fork to continue..
Also I am going to fix our code, so we do not need additional checks in upstream. Although, those checks may make sense in general (but not in this branch). |
This reverts commit 419b1ab. #1 (comment)
@modos189 |
Please check comments regarding padding option. |
My fault, thank you for pointing out. |
I saw you similar change in |
I've just updated that branch with your last commit. |
As all needed for IITC features are now separated between own branches, all we need - merge them together, like this:
I've already done this in All future updates should go to feature branches, here we'll need merge them together only. P.S. |
@modos189 I am unable to check it, as I just do not understand how it should function. |
`this._markers` is undefined in `_searchPoints`, called from event listeners. Now we check markers existence in the beginning of handlers. Note 1: Could be fixed in some another place: e.g. check `_markers` in `_searchPoints` ...or initialize (empty) `_markers` on CanvasMarkerLayer init Note 2: `!this._map` removed from condition in `_onMouseMove:` 'cause it's never should be true as we detach listeners on remove from map
Original intentions of that refactoring is not clear, perhaps it was intermediate step before transforming into true Renderer. But in current state it is not actually Renderer, so we need to revert some parts, to continue using it as independent Layer. Notes: `CanvasMarkerLayer` is still independent entity which does not fit flawlessly into Leaflet ecosystem. It would be much more convenient if instead of `CanvasMarkerLayer` we have `CanvasMarker`, able to be used as direct and transparent replacement for `L.Marker`. Though currently I am not sure how to do it best: - may be we need dedicated Renderer class - or may be it can be simpler, and all we need - `CanvasMarker` inherited from `L.Path`.
Was protected in marker add time, but not on zoom/pan Sample: ``` VM2992:16252 Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state. at NewClass._drawImage (<anonymous>:16252:23) at NewClass._drawMarker (<anonymous>:16239:22) at <anonymous>:16200:22 at Array.forEach (<anonymous>) at NewClass._draw (<anonymous>:16179:16) at NewClass._redraw (<anonymous>:16077:18) at NewClass.fire (<anonymous>:1867:11) at NewClass._move (<anonymous>:5506:9) at NewClass._onZoomTransitionEnd (<anonymous>:5963:8) ```
This was originally meant but missed (see _full.js / _standalone.js)
…adding-option' into test
It's all working now. |
@modos189 |
In IITC-CE/ingress-intel-total-conversion#181 which branch is being used? I used that version and I thought it was from test branch up: Indeed, these changes already exist in the test branch |
f7b32c9
to
062744c
Compare
Do you still need this branch? If not then I will rewrite it with actual commits. |
No, you can rewrite |
Please check this comment: 71eab75#commitcomment-33502466 |
I'm totally confused in branches, so I created a new branch for onresize method: https://github.com/IITC-CE/Leaflet.Canvas-Markers/tree/onresize Merge after this: #1 (comment) |
We have independent branch for every new feature here. We keep it so it will be easy to make PR's to parent repo in the future. And all that branches merge together here, in So to complete our work here we should finish last branch, for what we have concerns: |
On one hand, this change is specific to IITC, and on other hand - for greater similarity with the leaflet. Perhaps we should create a parameter to determine whether the container should be destroyed.
See: b6c228a