Skip to content
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

Layer adjustments #5479

Merged
merged 6 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 7 additions & 22 deletions css/20_map.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@

/* `.target` objects are interactive */
/* They can be picked up, clicked, hovered, or things can connect to them */
.node.target {
.node.target,
.turn .target {
pointer-events: fill;
fill-opacity: 0.8;
fill: currentColor;
Expand All @@ -50,6 +51,7 @@
stroke-linejoin: round;
}


/* `.target-nope` objects are explicitly forbidden to join to */
.surface:not(.nope-disabled) .node.target.target-nope,
.surface:not(.nope-disabled) .way.target.target-nope {
Expand All @@ -66,7 +68,6 @@


/* points & notes */

g.note .stroke {
stroke: #222;
stroke-width: 1;
Expand Down Expand Up @@ -118,21 +119,17 @@ g.point ellipse.stroke {


/* vertices and midpoints */

g.vertex .fill {
fill: #000;
}

g.vertex .stroke {
stroke: #666;
stroke-width: 1;
fill: white;
}

g.vertex.shared .stroke {
fill: #bbb;
}

g.midpoint .fill {
fill: #eee;
stroke: #444;
Expand Down Expand Up @@ -160,7 +157,6 @@ g.vertex.selected .shadow {


/* lines */

.preset-icon .icon.iD-other-line {
color: #fff;
fill: #777;
Expand Down Expand Up @@ -198,7 +194,6 @@ path.line.stroke {


/* Labels / Markers */

text {
font-size: 10px;
color: #222;
Expand Down Expand Up @@ -238,17 +233,16 @@ text.pointlabel {
dominant-baseline: auto;
}

.layer-labels-halo text {
.labels-group.halo text {
opacity: 0.7;
stroke: #fff;
stroke-width: 5px;
stroke-miterlimit: 1;
}

text.nolabel {
opacity: 0;
opacity: 0 !important;
}

text.point {
font-size: 10px;
}
Expand All @@ -259,14 +253,12 @@ text.point {
stroke-width: 2px;
stroke-miterlimit: 1;
}

.icon.areaicon {
fill: #222;
opacity: 0.8;
}

/* Highlighting */

g.point.highlighted .shadow,
path.shadow.highlighted {
stroke-opacity: 0.95;
Expand All @@ -279,16 +271,9 @@ g.vertex.highlighted .shadow {
}

/* Turn Restrictions */

g.turn rect,
g.turn circle {
.points-group.turns g.turn rect,
.points-group.turns g.turn circle {
fill: none;
pointer-events: all;
}

.form-field-restrictions .vertex {
cursor: auto !important;
pointer-events: none;
}

/* Turn restriction paths and vertices */
Expand Down
1 change: 0 additions & 1 deletion css/70_fills.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
}

.fill-wireframe .point,
.fill-wireframe .vertex.active,
.fill-wireframe .areaicon,
.fill-wireframe .areaicon-halo,
.fill-wireframe path.casing,
Expand Down
2 changes: 1 addition & 1 deletion modules/modes/drag_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export function modeDragNode(context) {


var drag = behaviorDrag()
.selector('.layer-points-targets .target')
.selector('.layer-touch.points .target')
.surface(d3_select('#map').node())
.origin(origin)
.on('start', start)
Expand Down
56 changes: 29 additions & 27 deletions modules/presets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,44 @@ export function presetIndex() {
};

all.match = function(entity, resolver) {
var geometry = entity.geometry(resolver);
var address;
return resolver.transient(entity, 'presetMatch', function() {
var geometry = entity.geometry(resolver);
var address;

// Treat entities on addr:interpolation lines as points, not vertices - #3241
if (geometry === 'vertex' && entity.isOnAddressLine(resolver)) {
geometry = 'point';
}
// Treat entities on addr:interpolation lines as points, not vertices - #3241
if (geometry === 'vertex' && entity.isOnAddressLine(resolver)) {
geometry = 'point';
}

var geometryMatches = _index[geometry];
var best = -1;
var match;
var geometryMatches = _index[geometry];
var best = -1;
var match;

for (var k in entity.tags) {
// If any part of an address is present,
// allow fallback to "Address" preset - #4353
if (k.match(/^addr:/) !== null && geometryMatches['addr:*']) {
address = geometryMatches['addr:*'][0];
}
for (var k in entity.tags) {
// If any part of an address is present,
// allow fallback to "Address" preset - #4353
if (k.match(/^addr:/) !== null && geometryMatches['addr:*']) {
address = geometryMatches['addr:*'][0];
}

var keyMatches = geometryMatches[k];
if (!keyMatches) continue;
var keyMatches = geometryMatches[k];
if (!keyMatches) continue;

for (var i = 0; i < keyMatches.length; i++) {
var score = keyMatches[i].matchScore(entity);
if (score > best) {
best = score;
match = keyMatches[i];
for (var i = 0; i < keyMatches.length; i++) {
var score = keyMatches[i].matchScore(entity);
if (score > best) {
best = score;
match = keyMatches[i];
}
}
}
}

if (address && (!match || match.isFallback())) {
match = address;
}
if (address && (!match || match.isFallback())) {
match = address;
}

return match || all.item(geometry);
return match || all.item(geometry);
});
};


Expand Down
18 changes: 8 additions & 10 deletions modules/renderer/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,14 @@ export function rendererMap(context) {
.on('mouseover.vertices', function() {
if (map.editable() && !_transformed) {
var hover = d3_event.target.__data__;
surface.selectAll('.data-layer-osm')
.call(drawVertices.drawHover, context.graph(), hover, map.extent());
surface.call(drawVertices.drawHover, context.graph(), hover, map.extent());
dispatch.call('drawn', this, { full: false });
}
})
.on('mouseout.vertices', function() {
if (map.editable() && !_transformed) {
var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
surface.selectAll('.data-layer-osm')
.call(drawVertices.drawHover, context.graph(), hover, map.extent());
surface.call(drawVertices.drawHover, context.graph(), hover, map.extent());
dispatch.call('drawn', this, { full: false });
}
});
Expand Down Expand Up @@ -232,7 +230,7 @@ export function rendererMap(context) {

data = context.features().filter(data, graph);

surface.selectAll('.data-layer-osm')
surface
.call(drawVertices.drawSelected, graph, map.extent())
.call(drawLines, graph, data, filter)
.call(drawAreas, graph, data, filter)
Expand Down Expand Up @@ -327,11 +325,10 @@ export function rendererMap(context) {
if (mode && mode.id === 'select') {
// update selected vertices - the user might have just double-clicked a way,
// creating a new vertex, triggering a partial redraw without a mode change
surface.selectAll('.data-layer-osm')
.call(drawVertices.drawSelected, graph, map.extent());
surface.call(drawVertices.drawSelected, graph, map.extent());
}

surface.selectAll('.data-layer-osm')
surface
.call(drawVertices, graph, data, filter, map.extent(), fullRedraw)
.call(drawLines, graph, data, filter)
.call(drawAreas, graph, data, filter)
Expand All @@ -346,6 +343,7 @@ export function rendererMap(context) {
function editOff() {
context.features().resetStats();
surface.selectAll('.layer-osm *').remove();
surface.selectAll('.layer-touch *').remove();

var mode = context.mode();
if (mode && mode.id !== 'save' && mode.id !== 'select-note' && mode.id !== 'select-data') {
Expand Down Expand Up @@ -838,15 +836,15 @@ export function rendererMap(context) {


map.editable = function() {
var osmLayer = surface.selectAll('.data-layer-osm');
var osmLayer = surface.selectAll('.data-layer.osm');
if (!osmLayer.empty() && osmLayer.classed('disabled')) return false;

return map.zoom() >= context.minEditableZoom();
};


map.notesEditable = function() {
var noteLayer = surface.selectAll('.data-layer-notes');
var noteLayer = surface.selectAll('.data-layer.notes');
if (!noteLayer.empty() && noteLayer.classed('disabled')) return false;

return map.zoom() >= context.minEditableZoom();
Expand Down
11 changes: 6 additions & 5 deletions modules/svg/areas.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ export function svgAreas(projection, context) {
.attr('d', path);


var layer = selection.selectAll('.layer-areas .layer-areas-areas');
var drawLayer = selection.selectAll('.layer-osm.areas');
var touchLayer = selection.selectAll('.layer-touch.areas');

var areagroup = layer
// Draw areas..
var areagroup = drawLayer
.selectAll('g.areagroup')
.data(['fill', 'shadow', 'stroke']);

Expand Down Expand Up @@ -188,7 +190,6 @@ export function svgAreas(projection, context) {
.merge(paths)
.each(function(entity) {
var layer = this.parentNode.__data__;

this.setAttribute('class', entity.type + ' area ' + layer + ' ' + entity.id);

if (layer === 'fill') {
Expand All @@ -200,8 +201,8 @@ export function svgAreas(projection, context) {
.attr('d', path);


// touch targets
selection.selectAll('.layer-areas .layer-areas-targets')
// Draw touch targets..
touchLayer
.call(drawTargets, graph, data.stroke, filter);
}

Expand Down
Loading