mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 16:49:40 +02:00
Merge pull request #5502 from jguthrie100/redraw_restrictions_on_sidebar_drag
Redraw restrictions panel when dragging sidebar
This commit is contained in:
@@ -66,6 +66,8 @@ export function uiFieldRestrictions(field, context) {
|
||||
var _intersection;
|
||||
var _fromWayID;
|
||||
|
||||
var _lastXPos;
|
||||
|
||||
|
||||
function restrictions(selection) {
|
||||
_parent = selection;
|
||||
@@ -293,15 +295,8 @@ export function uiFieldRestrictions(field, context) {
|
||||
|
||||
surface
|
||||
.call(breathe);
|
||||
|
||||
d3_select(window)
|
||||
.on('resize.restrictions', function() {
|
||||
utilSetDimensions(_container, null);
|
||||
redraw();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// This can happen if we've lowered the detail while a FROM way
|
||||
// is selected, and that way is no longer part of the intersection.
|
||||
if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
|
||||
@@ -335,6 +330,11 @@ export function uiFieldRestrictions(field, context) {
|
||||
.classed('related', true);
|
||||
}
|
||||
|
||||
document.addEventListener('resizeWindow', function () {
|
||||
utilSetDimensions(_container, null);
|
||||
redraw(1);
|
||||
}, false);
|
||||
|
||||
updateHints(null);
|
||||
|
||||
|
||||
@@ -435,10 +435,20 @@ export function uiFieldRestrictions(field, context) {
|
||||
updateHints(datum);
|
||||
}
|
||||
|
||||
_lastXPos = _lastXPos || sdims[0];
|
||||
|
||||
function redraw() {
|
||||
if (context.hasEntity(_vertexID)) {
|
||||
_container.call(renderViewer);
|
||||
function redraw(minChange) {
|
||||
var xPos = -1;
|
||||
|
||||
if (minChange) {
|
||||
xPos = utilGetDimensions(d3_select('#sidebar'))[0];
|
||||
}
|
||||
|
||||
if (!minChange || (minChange && Math.abs(xPos - _lastXPos) >= minChange)) {
|
||||
if (context.hasEntity(_vertexID)) {
|
||||
_lastXPos = xPos;
|
||||
_container.call(renderViewer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -411,6 +411,13 @@ export function uiInit(context) {
|
||||
// check if header or footer have overflowed
|
||||
ui.checkOverflow('#bar');
|
||||
ui.checkOverflow('#footer');
|
||||
|
||||
// Use outdated code so it works on Explorer
|
||||
var resizeWindowEvent = document.createEvent('Event');
|
||||
|
||||
resizeWindowEvent.initEvent('resizeWindow', true, true);
|
||||
|
||||
document.dispatchEvent(resizeWindowEvent);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@ export function uiSidebar(context) {
|
||||
selection
|
||||
.style('width', widthPct + '%') // lock in current width
|
||||
.style('max-width', '85%'); // but allow larger widths
|
||||
|
||||
resizer.classed('dragging', true);
|
||||
})
|
||||
.on('drag', function() {
|
||||
var isRTL = (textDirection === 'rtl');
|
||||
@@ -97,6 +99,9 @@ export function uiSidebar(context) {
|
||||
}
|
||||
}
|
||||
})
|
||||
.on('end', function() {
|
||||
resizer.classed('dragging', false);
|
||||
})
|
||||
);
|
||||
|
||||
var featureListWrap = selection
|
||||
|
||||
Reference in New Issue
Block a user