Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix copy OSD layout for electron #2183

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions tabs/osd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3160,22 +3160,26 @@ OSD.GUI.updateAll = function() {
}
});

paste.on('click', function() {
paste.on('click', async function() {
if(layout_clipboard.filled == true){

var oldLayout = JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout]))
OSD.data.layouts[OSD.data.selected_layout] = JSON.parse(JSON.stringify(layout_clipboard.layout));
layouts.trigger('change');
OSD.data.layouts[OSD.data.selected_layout].forEach(function(item, index){

for(var index in OSD.data.layouts[OSD.data.selected_layout])
{
var item = OSD.data.layouts[OSD.data.selected_layout][index];
if(!(item.isVisible === false && oldLayout[index].isVisible === false) && (oldLayout[index].x !== item.x || oldLayout[index].y !== item.y || oldLayout[index].position !== item.position || oldLayout[index].isVisible !== item.isVisible)){
OSD.saveItem({id: index});
await OSD.saveItem({id: index});
}
});
}

GUI.log(i18n.getMessage('osdLayoutPasteFromClipboard'));
}
});

clear.on('click', function() {
clear.on('click', async function() {
var oldLayout = JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout]));

var clearedLayout = [];
Expand All @@ -3187,12 +3191,15 @@ OSD.GUI.updateAll = function() {

OSD.data.layouts[OSD.data.selected_layout] = clearedLayout;
layouts.trigger('change');
OSD.data.layouts[OSD.data.selected_layout].forEach(function(item, index){

for(var index in OSD.data.layouts[OSD.data.selected_layout]) {
var item = OSD.data.layouts[OSD.data.selected_layout][index];
if(oldLayout[index].isVisible === true){
OSD.saveItem({id: index});
await OSD.saveItem({id: index});
}
});
GUI.log(chrome.i18n.getMessage('osdClearLayout'));
}

GUI.log(i18n.getMessage('osdClearLayout'));
});


Expand Down
Loading