minor fix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-11-23 16:31:16 +03:00
parent 8bb6bd8686
commit d3e54c83ac

View File

@ -419,7 +419,6 @@ var ElectronHostActions = actions.Actions({
}], }],
// XXX should this support resizing??? // XXX should this support resizing???
// XXX might be good to rotate the image if needed...
copy: ['Image|Edit/Copy image', copy: ['Image|Edit/Copy image',
core.doc`Copy image core.doc`Copy image
@ -429,32 +428,22 @@ var ElectronHostActions = actions.Actions({
Copy best matching preview of current image... Copy best matching preview of current image...
.copy(size) .copy(size)
NOTE: this will rotate and flip the image according to image metadata...
`, `,
function(size){ function(size){
/* XXX this does not rotate the image...
var url = this.images.getBestPreview(this.current, size, true).url
electron.clipboard.write({
title: this.images.getImageFileName(),
text: url,
image: electron.nativeImage.createFromPath(url),
})
//*/
var that = this var that = this
var url = this.images.getBestPreview(this.current, size, true).url var url = this.images.getBestPreview(this.current, size, true).url
// compatibility -- windows paths... // prep image for copy...
url = process.platform.startsWith('win') ?
url.replace(/\//g, '\\')
: url
img2canvas({ img2canvas({
...this.images[this.current],
url, url,
...this.images[this.current]
}, function(c){ }, function(c){
electron.clipboard.write({ electron.clipboard.write({
bookmark: that.images.getImageFileName(), bookmark: that.images.getImageFileName(),
text: url, // compatibility -- windows paths...
// XXX this seems not to work with images with exif text: process.platform.startsWith('win') ?
// orientation -- the ig orientation seems to be url.replace(/\//g, '\\')
// ignored... : url,
image: electron.nativeImage.createFromDataURL(c.toDataURL('image/png')), image: electron.nativeImage.createFromDataURL(c.toDataURL('image/png')),
}) }) }], }) }) }],
paste: ['- Image|Edit/Paste image', paste: ['- Image|Edit/Paste image',