mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
docs, notes and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
06fa563d04
commit
4cd1da4060
@ -3,6 +3,20 @@ Hacks and fixes
|
||||
===============
|
||||
|
||||
|
||||
20201104:
|
||||
Chrome v83 / Electron 9.3.3
|
||||
|
||||
WebKit canvas' .drawImage(..) ignores its and images .style.imageOrientation
|
||||
unless both are added to DOM.
|
||||
|
||||
FIX:
|
||||
- features/app.js: img2canvas(..) quietly adds the elements to DOM and then cleans up
|
||||
|
||||
TODO:
|
||||
- test in browser...
|
||||
- test in newer versions of browser / electron...
|
||||
- if not fixed report...
|
||||
|
||||
|
||||
|
||||
20200830:
|
||||
@ -24,7 +38,7 @@ FIX:
|
||||
- index.html / electron.html: added <video> tag with data/blank.mp4 as source
|
||||
|
||||
TODO:
|
||||
- document and post a bug report
|
||||
- report this...
|
||||
|
||||
|
||||
|
||||
|
||||
@ -32,17 +32,16 @@ var widgets = require('features/ui-widgets')
|
||||
/*********************************************************************/
|
||||
// helpers...
|
||||
|
||||
// XXX this includes a WebKit bug patch -- see inside...
|
||||
var img2canvas =
|
||||
function({url, orientation, flipped}, callback){
|
||||
var img = new Image
|
||||
|
||||
|
||||
// XXX PATCH...
|
||||
// XXX <canvas>.drawImage(..) seems to take EXIF into account, ignoring
|
||||
// the .imageOrientation setting both the canvas and image are in
|
||||
// DOM and the image needs to be added to dom before .src is set
|
||||
var PATCHED_ELEMENTS
|
||||
var PATCH_BUG = function(e){
|
||||
var PATCH = function(e){
|
||||
PATCHED_ELEMENTS =
|
||||
PATCHED_ELEMENTS
|
||||
|| document.body.appendChild(
|
||||
@ -56,13 +55,13 @@ function({url, orientation, flipped}, callback){
|
||||
this.style.opacity = 0
|
||||
this.style.overflow = 'hidden' }))
|
||||
PATCHED_ELEMENTS.appendChild(e) }
|
||||
// XXX PATCH...
|
||||
var CLEANUP_PATCH = function(){
|
||||
PATCHED_ELEMENTS
|
||||
.parentElement
|
||||
.removeChild(PATCHED_ELEMENTS) }
|
||||
// XXX END PATCH...
|
||||
|
||||
|
||||
var img = new Image
|
||||
img.onload = function(){
|
||||
var width = this.naturalWidth
|
||||
var height = this.naturalHeight
|
||||
@ -71,7 +70,7 @@ function({url, orientation, flipped}, callback){
|
||||
c.style.imageOrientation = 'none'
|
||||
|
||||
// XXX PATCH...
|
||||
PATCH_BUG(c)
|
||||
PATCH(c)
|
||||
|
||||
var ctx = c.getContext('2d')
|
||||
// prepare for rotate...
|
||||
@ -104,15 +103,16 @@ function({url, orientation, flipped}, callback){
|
||||
// prevent the browser from rotating the image via exif...
|
||||
img.style.imageOrientation = 'none'
|
||||
img.crossOrigin = ''
|
||||
img.src = url
|
||||
|
||||
// XXX PATCH...
|
||||
PATCH_BUG(img)
|
||||
PATCH(img)
|
||||
|
||||
img.src = url
|
||||
return img }
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
var Widget =
|
||||
|
||||
@ -649,11 +649,10 @@ module.Sharp = core.ImageGridFeatures.Feature({
|
||||
isApplicable: function(){ return !!sharp },
|
||||
|
||||
handlers: [
|
||||
/* XXX not sure if we need this...
|
||||
// XXX this is best done in a thread + needs to be abortable...
|
||||
/* XXX this needs to be run in the background...
|
||||
// XXX this is best done in a thread + needs to be abortable (on .load(..))...
|
||||
['loadImages',
|
||||
function(){
|
||||
//this.cacheImageMetadata('all', false) }],
|
||||
this.cacheImageMetadata('all') }],
|
||||
//*/
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user