mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 09:34:04 +02:00
Rename widget -> panel
This commit is contained in:
+10
-15
@@ -2669,50 +2669,45 @@ img.tile-removing {
|
||||
color: #ff8;
|
||||
}
|
||||
|
||||
.widget-container {
|
||||
.panel-container {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.widget-container:first-of-type,
|
||||
.widget-container:first-of-type .widget-title {
|
||||
.panel-container:first-of-type,
|
||||
.panel-container:first-of-type .panel-title {
|
||||
border-radius: 4px 0 0 0;
|
||||
}
|
||||
|
||||
.widget-container:last-of-type {
|
||||
.panel-container:last-of-type {
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.widget-title {
|
||||
.panel-title {
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
.widget-title button.close {
|
||||
.panel-title button.close {
|
||||
float: right;
|
||||
height: 20px;
|
||||
background: none;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.widget-title button.close:hover {
|
||||
.panel-title button.close:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.widget-title button.close .icon {
|
||||
.panel-title button.close .icon {
|
||||
height: 20px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.widget-content {
|
||||
.panel-content {
|
||||
padding: 5px 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.widget-content-measurement .measurement-heading {
|
||||
/* display: inline-block;
|
||||
height: 30px;
|
||||
*/}
|
||||
|
||||
.widget-content-measurement .button {
|
||||
.panel-content-measurement .button {
|
||||
position: absolute;
|
||||
background: #7092ff;
|
||||
border-radius: 2px;
|
||||
|
||||
+15
-15
@@ -3,19 +3,19 @@ import { d3keybinding } from '../lib/d3.keybinding.js';
|
||||
import { t } from '../util/locale';
|
||||
import { svgIcon } from '../svg/index';
|
||||
import { uiCmd } from './cmd';
|
||||
import { uiInfoWidgets } from './info/index';
|
||||
import { uiInfoPanels } from './info/index';
|
||||
|
||||
|
||||
export function uiInfo(context) {
|
||||
var ids = Object.keys(uiInfoWidgets),
|
||||
var ids = Object.keys(uiInfoPanels),
|
||||
wasActive = ['measurement'],
|
||||
widgets = {},
|
||||
panels = {},
|
||||
active = {};
|
||||
|
||||
// create widgets
|
||||
// create panels
|
||||
ids.forEach(function(k) {
|
||||
if (!widgets[k]) {
|
||||
widgets[k] = uiInfoWidgets[k](context);
|
||||
if (!panels[k]) {
|
||||
panels[k] = uiInfoPanels[k](context);
|
||||
active[k] = false;
|
||||
}
|
||||
});
|
||||
@@ -26,7 +26,7 @@ export function uiInfo(context) {
|
||||
function redraw() {
|
||||
var activeids = ids.filter(function(k) { return active[k]; }).sort();
|
||||
|
||||
var containers = infobox.selectAll('.widget-container')
|
||||
var containers = infobox.selectAll('.panel-container')
|
||||
.data(activeids, function(k) { return k; });
|
||||
|
||||
containers.exit()
|
||||
@@ -36,13 +36,13 @@ export function uiInfo(context) {
|
||||
.style('opacity', 0)
|
||||
.on('end', function(d) {
|
||||
d3.select(this)
|
||||
.call(widgets[d].off)
|
||||
.call(panels[d].off)
|
||||
.remove();
|
||||
});
|
||||
|
||||
var enter = containers.enter()
|
||||
.append('div')
|
||||
.attr('class', function(d) { return 'fillD2 widget-container widget-container-' + d; });
|
||||
.attr('class', function(d) { return 'fillD2 panel-container panel-container-' + d; });
|
||||
|
||||
enter
|
||||
.style('opacity', 0)
|
||||
@@ -52,11 +52,11 @@ export function uiInfo(context) {
|
||||
|
||||
var title = enter
|
||||
.append('div')
|
||||
.attr('class', 'widget-title fillD2');
|
||||
.attr('class', 'panel-title fillD2');
|
||||
|
||||
title
|
||||
.append('h3')
|
||||
.text(function(d) { return widgets[d].title; });
|
||||
.text(function(d) { return panels[d].title; });
|
||||
|
||||
title
|
||||
.append('button')
|
||||
@@ -66,13 +66,13 @@ export function uiInfo(context) {
|
||||
|
||||
enter
|
||||
.append('div')
|
||||
.attr('class', function(d) { return 'widget-content widget-content-' + d; });
|
||||
.attr('class', function(d) { return 'panel-content panel-content-' + d; });
|
||||
|
||||
|
||||
// redraw the widgets
|
||||
infobox.selectAll('.widget-content')
|
||||
// redraw the panels
|
||||
infobox.selectAll('.panel-content')
|
||||
.each(function(d) {
|
||||
d3.select(this).call(widgets[d]);
|
||||
d3.select(this).call(panels[d]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
export * from './location';
|
||||
export * from './measurement';
|
||||
|
||||
import { uiInfoLocation } from './location';
|
||||
import { uiInfoMeasurement } from './measurement';
|
||||
import { uiPanelLocation } from './location';
|
||||
import { uiPanelMeasurement } from './measurement';
|
||||
|
||||
export var uiInfoWidgets = {
|
||||
location: uiInfoLocation,
|
||||
measurement: uiInfoMeasurement,
|
||||
export var uiInfoPanels = {
|
||||
location: uiPanelLocation,
|
||||
measurement: uiPanelMeasurement,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as d3 from 'd3';
|
||||
import { t } from '../../util/locale';
|
||||
|
||||
|
||||
export function uiInfoLocation(context) {
|
||||
export function uiPanelLocation(context) {
|
||||
var OSM_PRECISION = 7;
|
||||
|
||||
function wrap(x, min, max) {
|
||||
@@ -35,7 +35,7 @@ export function uiInfoLocation(context) {
|
||||
}
|
||||
|
||||
|
||||
var widget = function(selection) {
|
||||
var panel = function(selection) {
|
||||
selection.call(redraw);
|
||||
|
||||
context.surface()
|
||||
@@ -44,15 +44,15 @@ export function uiInfoLocation(context) {
|
||||
});
|
||||
};
|
||||
|
||||
widget.off = function() {
|
||||
panel.off = function() {
|
||||
context.surface()
|
||||
.on('mousemove.info-location', null);
|
||||
};
|
||||
|
||||
widget.id = 'location';
|
||||
widget.title = t('infobox.location.title');
|
||||
widget.key = t('infobox.location.key');
|
||||
panel.id = 'location';
|
||||
panel.title = t('infobox.location.title');
|
||||
panel.key = t('infobox.location.key');
|
||||
|
||||
|
||||
return widget;
|
||||
return panel;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from 'd3';
|
||||
|
||||
|
||||
export function uiInfoMeasurement(context) {
|
||||
export function uiPanelMeasurement(context) {
|
||||
var isImperial = (utilDetect().locale.toLowerCase() === 'en-us');
|
||||
var OSM_PRECISION = 7;
|
||||
|
||||
@@ -212,7 +212,7 @@ export function uiInfoMeasurement(context) {
|
||||
|
||||
|
||||
|
||||
var widget = function(selection) {
|
||||
var panel = function(selection) {
|
||||
selection.call(redraw);
|
||||
|
||||
context.map()
|
||||
@@ -221,15 +221,15 @@ export function uiInfoMeasurement(context) {
|
||||
});
|
||||
};
|
||||
|
||||
widget.off = function() {
|
||||
panel.off = function() {
|
||||
context.map()
|
||||
.on('drawn.info-measurement', null);
|
||||
};
|
||||
|
||||
widget.id = 'measurement';
|
||||
widget.title = t('infobox.measurement.title');
|
||||
widget.key = t('infobox.measurement.key');
|
||||
panel.id = 'measurement';
|
||||
panel.title = t('infobox.measurement.title');
|
||||
panel.key = t('infobox.measurement.key');
|
||||
|
||||
|
||||
return widget;
|
||||
return panel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user