mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
Consolidate localization behavior and init to a coreLocalizer function and singleton Explicitly support `en-US` locale Rename coreData to coreFileFetcher and export a singleton rather than using a property of coreContext Add `apiConnections` property of coreContext to simplify adding a source switcher Replace some init functions with re-callable, promise-supporting `ensureLoaded` functions Make coreContext itself load the UI if a container has been specified at init time Fix code tests
30 lines
879 B
JavaScript
30 lines
879 B
JavaScript
import { t, localizer } from '../../core/localizer';
|
|
import { svgIcon } from '../../svg';
|
|
import { uiTooltip } from '../tooltip';
|
|
|
|
export function uiToolSidebarToggle(context) {
|
|
|
|
var tool = {
|
|
id: 'sidebar_toggle',
|
|
label: t('toolbar.inspect')
|
|
};
|
|
|
|
tool.render = function(selection) {
|
|
selection
|
|
.append('button')
|
|
.attr('class', 'bar-button')
|
|
.on('click', function() {
|
|
context.ui().sidebar.toggle();
|
|
})
|
|
.call(uiTooltip()
|
|
.placement('bottom')
|
|
.title(t('sidebar.tooltip'))
|
|
.keys([t('sidebar.key')])
|
|
.scrollContainer(context.container().select('.top-toolbar'))
|
|
)
|
|
.call(svgIcon('#iD-icon-sidebar-' + (localizer.textDirection() === 'rtl' ? 'right' : 'left')));
|
|
};
|
|
|
|
return tool;
|
|
}
|