-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Rewrite debug.html
to show and inspect all layers
#820
Conversation
Some refs.
Core code in mapbox-gl-inspect: function circleLayer(color, source, vectorLayer) {
var layer = {
id: [source, vectorLayer, 'circle'].join('_'),
source: source,
type: 'circle',
paint: {
'circle-color': color,
'circle-radius': 2
},
filter: ['==', '$type', 'Point']
};
if (vectorLayer) {
layer['source-layer'] = vectorLayer;
}
return layer;
}
function polygonLayer(color, outlineColor, source, vectorLayer) {
var layer = {
id: [source, vectorLayer, 'polygon'].join('_'),
source: source,
type: 'fill',
paint: {
'fill-color': color,
'fill-antialias': true,
'fill-outline-color': color
},
filter: ['==', '$type', 'Polygon']
};
if (vectorLayer) {
layer['source-layer'] = vectorLayer;
}
return layer;
}
function lineLayer(color, source, vectorLayer) {
var layer = {
id: [source, vectorLayer, 'line'].join('_'),
source: source,
layout: {
'line-join': 'round',
'line-cap': 'round'
},
type: 'line',
paint: {
'line-color': color
},
filter: ['==', '$type', 'LineString']
};
if (vectorLayer) {
layer['source-layer'] = vectorLayer;
}
return layer;
}
Object.keys(sources).forEach(function (sourceId) {
var layers = sources[sourceId];
if (!layers || layers.length === 0) {
var colors = alphaColors(sourceId);
circleLayers.push(circleLayer(colors.circle, sourceId));
lineLayers.push(lineLayer(colors.line, sourceId));
polyLayers.push(polygonLayer(colors.polygon, colors.polygonOutline, sourceId));
} else {
layers.forEach(function (layerId) {
var colors = alphaColors(layerId);
circleLayers.push(circleLayer(colors.circle, sourceId, layerId));
lineLayers.push(lineLayer(colors.line, sourceId, layerId));
polyLayers.push(polygonLayer(colors.polygon, colors.polygonOutline, sourceId, layerId));
});
}
}); |
thanks! we ought to find a way to discover available layers... we may even have to add that to MapLibre-web itself |
888d24d
to
352ffbc
Compare
c356820
to
a6c3328
Compare
debug.html
to show and inspect all layers
why would we want an inspect toggle? It makes sense for a site that shows all geometries with complex rules (e.g. Maputnik with all the rules). But for the debug screen, we essentially always want to have |
I was wondering that. But yeah, It's a debug screen. We need the inspect mode all the time. |
i did a minor cleanup of the sources - i think you have a similar bug here - see #853 |
Oops. I missed the changes in Future-proof source catalog after rebase |
a6c3328
to
7db553e
Compare
7db553e
to
27e1c6b
Compare
I love this new approach!!! There are a few minor things I think we need to fix before merging:
|
P.S. do we want to remove color picker here? |
P.P.S. some layers are not clickable. Is it because they are polygons? If so, we may want to disable them for now? Show them as grayed out |
They are The reason why previous version
But we shouldn't assume that each source has a layer with the same name(though we hard coded same name layers in test/sql files), and we shouldn't assume each layer is circle type. |
ea32614
to
1f7f754
Compare
What's the expected behavior for color picker here? It's possible to have many layers in one source:
|
I'm not sure we can do anything meaningful with random colors or color groups. Rather, I think we can just generate random colors on each layer |
I added a few minor cleanups in sharkAndshark#51 please merge if agree. For some reason your debug.html does not hide popup when I move the mouse away from the point. |
minor linting of the debughtml
dd0ad1d
to
681ce97
Compare
681ce97
to
b559f68
Compare
* change color on each enable * show color when the button is selected
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.
thanks!!!
Try to resolve #536, but still it can't show the function source without comment...
Maybe we should have an inspect toggle?