mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-09 17:17:41 +00:00
Merge pull request #16509 from keymanapp/fix/developer/11209-remember-presentation-on-platform-switch
fix(developer): remember presentation and layer when switching platforms in touch layout editor
This commit is contained in:
commit
1795f9b35b
3 changed files with 16 additions and 2 deletions
|
|
@ -10,6 +10,8 @@ $(function() {
|
|||
this.yscale = 1;
|
||||
this.uniqId = 1;
|
||||
|
||||
this.lastPresentations = {...this.defaultPresentations};
|
||||
this.lastLayers = {};
|
||||
|
||||
this.getPresentation = function () {
|
||||
return $('#selPlatformPresentation').val();
|
||||
|
|
@ -41,6 +43,7 @@ $(function() {
|
|||
}
|
||||
|
||||
builder.selPlatformPresentationChange = function () {
|
||||
builder.lastPresentations[builder.lastPlatform] = builder.getPresentation();
|
||||
let lastSelection = builder.saveSelection();
|
||||
builder.selectKey(null, false);
|
||||
builder.selectSubKey(null);
|
||||
|
|
@ -493,11 +496,14 @@ $(function() {
|
|||
}
|
||||
var option = $(document.createElement('option'));
|
||||
option.attr('value', i).text(this.presentations[i].name);
|
||||
if(builder.lastPresentations[builder.lastPlatform] == i) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
listContainer.append(option);
|
||||
}
|
||||
|
||||
builder.prepareLayers();
|
||||
builder.selectLayer(0);
|
||||
builder.selectLayer(builder.lastLayers[builder.lastPlatform] ?? 0);
|
||||
}
|
||||
|
||||
this.selectLayer = function (val) {
|
||||
|
|
@ -1079,7 +1085,9 @@ $(function() {
|
|||
var state = {
|
||||
platform: builder.lastPlatform,
|
||||
layer: builder.lastLayerIndex,
|
||||
presentation: $('#selPlatformPresentation').val()
|
||||
presentation: $('#selPlatformPresentation').val(),
|
||||
lastPresentations: builder.lastPresentations,
|
||||
lastLayers: builder.lastLayers,
|
||||
};
|
||||
|
||||
var key = builder.selectedKey();
|
||||
|
|
@ -1119,6 +1127,9 @@ $(function() {
|
|||
$('#selPlatformPresentation').val($('#selPlatformPresentation option:first').val());
|
||||
}
|
||||
|
||||
builder.lastPresentations = {...(data.lastPresentations ?? this.defaultPresentations)};
|
||||
builder.lastLayers = {...(data.lastLayers ?? {})};
|
||||
|
||||
let selection = builder.saveSelection();
|
||||
builder.prepareLayer();
|
||||
builder.restoreSelection(selection);
|
||||
|
|
|
|||
|
|
@ -631,6 +631,8 @@ $(function() {
|
|||
"desktop": { "x": 640, "y": 300, "name": "Desktop" },
|
||||
};
|
||||
|
||||
this.defaultPresentations = { "tablet": "tablet-ipad-landscape", "phone": "phone-iphone5-landscape", "desktop": "desktop" };
|
||||
|
||||
this.keyMargin = 15;
|
||||
|
||||
// from kmwosk.js:
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ $(function() {
|
|||
});
|
||||
|
||||
$('#selLayer').change(function () {
|
||||
builder.lastLayers[builder.lastPlatform] = $('#selLayer').val();
|
||||
if (builder.lastPlatform) builder.generate(false,false);
|
||||
let selection = builder.saveSelection();
|
||||
builder.selectLayer();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue