Skip to content

Commit

Permalink
[PDF] Fix stamp preview
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Dec 23, 2024
1 parent 356ee6b commit 747a9f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/pdfeditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,16 +1171,22 @@ define([
var arr = this.api.asc_getPropertyEditorStamps(),
template = _.template([
'<a id="<%= id %>" tabindex="-1" type="menuitem">',
'<img style="width: auto; height: auto;" src="<%= options.stampImage %>"></img>',
'<div style="width:<%= options.itemWidth %>px; height:<%= options.itemHeight %>px;"></div>',
'</a>'
].join(''));
arr.forEach(function(item){
var menuItem = new Common.UI.MenuItem({
value: item.Type,
stampImage: item.Image,
itemWidth: item.Image.width/Common.Utils.applicationPixelRatio(),
itemHeight: item.Image.height/Common.Utils.applicationPixelRatio(),
template: template
});
menu.addItem(menuItem, true);
if (menuItem.cmpEl) {
menuItem.cmpEl.find('div').append(item.Image);
menuItem.cmpEl.find('canvas').css({width: '100%', height: '100%'});
}

});
this.toolbar.btnStamp.options.stampType = arr[0].Type;
}
Expand Down
10 changes: 10 additions & 0 deletions apps/pdfeditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,16 @@ define([
me.btnStamp.setMenu(new Common.UI.Menu({
restoreHeight: 500
}));
var menu = me.btnStamp.menu;
if (menu.cmpEl) {
menu.cmpEl.attr('ratio', 'ratio');
menu.cmpEl.on('app:scaling', function (e, info) {
if ( me.options.scaling != info.ratio ) {
menu.hide();
menu.removeAll();
}
});
}
}
});
},
Expand Down

0 comments on commit 747a9f1

Please sign in to comment.