Skip to content

Commit

Permalink
Merge pull request #9922 from keymanapp/fix/developer/7851-restore-se…
Browse files Browse the repository at this point in the history
…lection-to-same-key-in-layout-builder

fix(developer): restore selection in layout builder even with duplicate ids
  • Loading branch information
mcdurdin authored Nov 2, 2023
2 parents 6be9fe6 + bd2315d commit 38d2c92
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions developer/src/tike/xml/layoutbuilder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,10 +865,17 @@ $(function() {

this.rescale = function () {
builder.saveUndo();
var keyId = builder.selectedKey().data('id');
const k = builder.selectedKey();
const keyId = k.data('id');
const keyItems = $('#kbd .key').filter((_index,item) => $(item).data('id') === keyId);
const keyItemIndex = keyItems.indexOf(k.length ? k[0] : null);
builder.prepareLayer();
if (keyId !== null)
builder.selectKey($('#kbd .key').filter(function (index) { return $(this).data('id') === keyId; }).first());
if (keyId !== null && keyItemIndex >= 0) {
const newKeyItems = $('#kbd .key').filter((_index,item) => $(item).data('id') === keyId);
if(keyItemIndex < newKeyItems.length) {
builder.selectKey(newKeyItems[keyItemIndex]);
}
}
};

this.translateFlickArrayToObject = function(flicks) {
Expand Down

0 comments on commit 38d2c92

Please sign in to comment.