Skip to content

Commit dae27ff

Browse files
committed
Made swap function. Fixed transition bug.
Created a swap function to reduce repetition of swapping the popup buffers. Resolved a transition bug where rapid clicking forward/backwards would leave the popup stack in an invalid state.
1 parent ddf5585 commit dae27ff

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

Import/Esri/ArcGISRuntime/Toolkit/Controls/PopupStackView.qml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,37 +286,44 @@ Item {
286286

287287
/*! internal */
288288
function nextPopup() {
289+
if (popupStack.busy)
290+
return;
291+
289292
if (currentIndex + 1 === popupManagers.length)
290293
return;
291294

292295
currentIndex += 1;
293296

294297
if (popupStack.currentItem === popup1) {
295-
popup2.popupManagerInternal = popupManagers[currentIndex]
296-
popupStack.replace(popup1, popup2);
298+
swapPopups(popup1, popup2);
297299
} else {
298-
popup1.popupManagerInternal = popupManagers[currentIndex]
299-
popupStack.replace(popup2, popup1);
300+
swapPopups(popup2, popup1);
300301
}
301302
}
302303

303304
/*! internal */
304305
function previousPopup() {
306+
if (popupStack.busy)
307+
return;
308+
305309
if (currentIndex === 0)
306310
return;
307311

308312
currentIndex -= 1;
309313

310-
if (popupStack.currentItem === popup2) {
311-
popup1.popupManagerInternal = popupManagers[currentIndex];
312-
popupStack.replace(popup2, popup1);
314+
if (popupStack.currentItem === popup1) {
315+
swapPopups(popup1, popup2);
313316
}
314317
else {
315-
popup2.popupManagerInternal = popupManagers[currentIndex];
316-
popupStack.replace(popup1, popup2);
318+
swapPopups(popup2, popup1);
317319
}
318320
}
319321

322+
function swapPopups(frontPopup, backPopup) {
323+
backPopup.popupManagerInternal = popupManagers[currentIndex];
324+
popupStack.replace(frontPopup, backPopup);
325+
}
326+
320327
/*! internal */
321328
function drawButton(canvas) {
322329
var ctx = canvas.getContext("2d");

0 commit comments

Comments
 (0)