mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Fix uiFlash issues
Clean up a few things from prior commit
This commit is contained in:
@@ -62,8 +62,7 @@ export function behaviorHash(context) {
|
||||
if (selected.length > 1 ) {
|
||||
contextual = t('title.labeled_and_more', {
|
||||
labeled: firstLabel,
|
||||
count: (selected.length - 1).toString(),
|
||||
html: false
|
||||
count: (selected.length - 1).toString()
|
||||
});
|
||||
} else {
|
||||
contextual = firstLabel;
|
||||
@@ -82,8 +81,7 @@ export function behaviorHash(context) {
|
||||
return t('title.format.' + titleID, {
|
||||
changes: changeCount,
|
||||
base: baseTitle,
|
||||
context: contextual,
|
||||
html: false
|
||||
context: contextual
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@ export function behaviorOperation(context) {
|
||||
.duration(4000)
|
||||
.iconName('#iD-operation-' + _operation.id)
|
||||
.iconClass('operation disabled')
|
||||
.text(_operation.tooltip)();
|
||||
.label(_operation.tooltip)();
|
||||
|
||||
} else {
|
||||
context.ui().flash
|
||||
.duration(2000)
|
||||
.iconName('#iD-operation-' + _operation.id)
|
||||
.iconClass('operation')
|
||||
.text(_operation.annotation() || _operation.title)();
|
||||
.label(_operation.annotation() || _operation.title)();
|
||||
|
||||
if (_operation.point) _operation.point(null);
|
||||
_operation();
|
||||
|
||||
@@ -8,7 +8,7 @@ let _t = _mainLocalizer.t;
|
||||
|
||||
export {
|
||||
_mainLocalizer as localizer,
|
||||
// export `t` functions for ease-of-use
|
||||
// export `t` function for ease-of-use
|
||||
_t as t
|
||||
};
|
||||
|
||||
|
||||
@@ -138,7 +138,8 @@ export function modeDragNode(context) {
|
||||
if (hasHidden) {
|
||||
context.ui().flash
|
||||
.duration(4000)
|
||||
.text(t('modes.drag_node.connected_to_hidden'))();
|
||||
.iconName('#iD-icon-no')
|
||||
.label(t('modes.drag_node.connected_to_hidden'))();
|
||||
}
|
||||
return drag.cancel();
|
||||
}
|
||||
@@ -237,7 +238,8 @@ export function modeDragNode(context) {
|
||||
if (!nope) { // about to nope - show hint
|
||||
context.ui().flash
|
||||
.duration(4000)
|
||||
.text(t('operations.connect.' + isInvalid,
|
||||
.iconName('#iD-icon-no')
|
||||
.label(t('operations.connect.' + isInvalid,
|
||||
{ relation: presetManager.item('type/restriction').name() }
|
||||
))();
|
||||
}
|
||||
@@ -245,12 +247,13 @@ export function modeDragNode(context) {
|
||||
var errorID = isInvalid === 'line' ? 'lines' : 'areas';
|
||||
context.ui().flash
|
||||
.duration(3000)
|
||||
.text(t('self_intersection.error.' + errorID))();
|
||||
.iconName('#iD-icon-no')
|
||||
.label(t('self_intersection.error.' + errorID))();
|
||||
} else {
|
||||
if (nope) { // about to un-nope, remove hint
|
||||
context.ui().flash
|
||||
.duration(1)
|
||||
.text('')();
|
||||
.label('')();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ export function modeDrawArea(context, wayID, startGraph, button) {
|
||||
var behavior = behaviorDrawWay(context, wayID, mode, startGraph)
|
||||
.on('rejectedSelfIntersection.modeDrawArea', function() {
|
||||
context.ui().flash
|
||||
.text(t('self_intersection.error.areas'))();
|
||||
.iconName('#iD-icon-no')
|
||||
.label(t('self_intersection.error.areas'))();
|
||||
});
|
||||
|
||||
mode.wayID = wayID;
|
||||
|
||||
@@ -11,7 +11,8 @@ export function modeDrawLine(context, wayID, startGraph, button, affix, continui
|
||||
var behavior = behaviorDrawWay(context, wayID, mode, startGraph)
|
||||
.on('rejectedSelfIntersection.modeDrawLine', function() {
|
||||
context.ui().flash
|
||||
.text(t('self_intersection.error.lines'))();
|
||||
.iconName('#iD-icon-no')
|
||||
.label(t('self_intersection.error.lines'))();
|
||||
});
|
||||
|
||||
mode.wayID = wayID;
|
||||
|
||||
@@ -305,7 +305,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
.duration(4000)
|
||||
.iconName('#iD-operation-' + moveOp.id)
|
||||
.iconClass('operation disabled')
|
||||
.text(moveOp.tooltip)();
|
||||
.label(moveOp.tooltip)();
|
||||
} else {
|
||||
context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
|
||||
context.validator().validate();
|
||||
@@ -378,7 +378,7 @@ export function modeSelect(context, selectedIDs) {
|
||||
.duration(4000)
|
||||
.iconName('#iD-icon-no')
|
||||
.iconClass('operation disabled')
|
||||
.text(t('operations.scale.' + disabled + '.' + multi))();
|
||||
.label(t('operations.scale.' + disabled + '.' + multi))();
|
||||
} else {
|
||||
const pivot = context.projection(extent.center());
|
||||
const annotation = t('operations.scale.annotation.' + (isUp ? 'up' : 'down') + '.feature', { n: selectedIDs.length });
|
||||
|
||||
@@ -148,7 +148,7 @@ export function uiEditMenu(context) {
|
||||
.duration(4000)
|
||||
.iconName('#iD-operation-' + operation.id)
|
||||
.iconClass('operation disabled')
|
||||
.html(operation.tooltip)();
|
||||
.label(operation.tooltip)();
|
||||
}
|
||||
} else {
|
||||
if (lastPointerUpType === 'touch' ||
|
||||
@@ -157,7 +157,7 @@ export function uiEditMenu(context) {
|
||||
.duration(2000)
|
||||
.iconName('#iD-operation-' + operation.id)
|
||||
.iconClass('operation')
|
||||
.html(operation.annotation() || operation.title)();
|
||||
.label(operation.annotation() || operation.title)();
|
||||
}
|
||||
|
||||
operation();
|
||||
|
||||
+6
-13
@@ -6,8 +6,7 @@ export function uiFlash(context) {
|
||||
var _duration = 2000;
|
||||
var _iconName = '#iD-icon-no';
|
||||
var _iconClass = 'disabled';
|
||||
var _text = '';
|
||||
var _textClass;
|
||||
var _label = '';
|
||||
|
||||
function flash() {
|
||||
if (_flashTimer) {
|
||||
@@ -64,8 +63,8 @@ export function uiFlash(context) {
|
||||
|
||||
content
|
||||
.selectAll('.flash-text')
|
||||
.attr('class', 'flash-text ' + (_textClass || ''))
|
||||
.html(_text);
|
||||
.attr('class', 'flash-text')
|
||||
.html(_label);
|
||||
|
||||
|
||||
_flashTimer = d3_timeout(function() {
|
||||
@@ -88,15 +87,9 @@ export function uiFlash(context) {
|
||||
return flash;
|
||||
};
|
||||
|
||||
flash.text = function(_) {
|
||||
if (!arguments.length) return _text;
|
||||
_text = _;
|
||||
return flash;
|
||||
};
|
||||
|
||||
flash.textClass = function(_) {
|
||||
if (!arguments.length) return _textClass;
|
||||
_textClass = _;
|
||||
flash.label = function(_) {
|
||||
if (!arguments.length) return _label;
|
||||
_label = _;
|
||||
return flash;
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ export function uiGeolocate(context) {
|
||||
zoomTo();
|
||||
} else {
|
||||
context.ui().flash
|
||||
.html(t.html('geolocate.location_unavailable'))
|
||||
.label(t.html('geolocate.location_unavailable'))
|
||||
.iconName('#iD-icon-geolocate')();
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -127,7 +127,9 @@ export function uiInit(context) {
|
||||
|
||||
map
|
||||
.on('hitMinZoom.ui', function() {
|
||||
ui.flash.html(t.html('cannot_zoom'))();
|
||||
ui.flash
|
||||
.iconName('#iD-icon-no')
|
||||
.label(t.html('cannot_zoom'))();
|
||||
});
|
||||
|
||||
container
|
||||
|
||||
@@ -102,7 +102,7 @@ export function uiToolSave(context) {
|
||||
.duration(2000)
|
||||
.iconName('#iD-icon-save')
|
||||
.iconClass('disabled')
|
||||
.html(t.html('save.no_changes'))();
|
||||
.label(t.html('save.no_changes'))();
|
||||
}
|
||||
lastPointerUpType = null;
|
||||
})
|
||||
|
||||
@@ -92,7 +92,7 @@ export function uiToolUndoRedo(context) {
|
||||
.duration(2000)
|
||||
.iconName('#' + d.icon)
|
||||
.iconClass(annotation ? '' : 'disabled')
|
||||
.html(text)();
|
||||
.label(text)();
|
||||
}
|
||||
lastPointerUpType = null;
|
||||
})
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ export function uiZoom(context) {
|
||||
.duration(2000)
|
||||
.iconName('#' + d.icon)
|
||||
.iconClass('disabled')
|
||||
.html(d.disabledTitle)();
|
||||
.label(d.disabledTitle)();
|
||||
}
|
||||
lastPointerUpType = null;
|
||||
})
|
||||
|
||||
@@ -26,7 +26,7 @@ export function uiZoomToSelection(context) {
|
||||
.duration(2000)
|
||||
.iconName('#iD-icon-framed-dot')
|
||||
.iconClass('disabled')
|
||||
.html(t.html('inspector.zoom_to.no_selection'))();
|
||||
.label(t.html('inspector.zoom_to.no_selection'))();
|
||||
}
|
||||
} else {
|
||||
var mode = context.mode();
|
||||
|
||||
Reference in New Issue
Block a user