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:
|
20200830:
|
||||||
@ -21,10 +35,10 @@ Chrome messing up fullscreen colors unless a <video> tag is present.
|
|||||||
|
|
||||||
FIX:
|
FIX:
|
||||||
- data/blank.mp4: added
|
- data/blank.mp4: added
|
||||||
- index.html/electron.html: added <video> tag with data/blank.mp4 as source
|
- index.html / electron.html: added <video> tag with data/blank.mp4 as source
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- document and post a bug report
|
- report this...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,17 +32,16 @@ var widgets = require('features/ui-widgets')
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
// helpers...
|
// helpers...
|
||||||
|
|
||||||
|
// XXX this includes a WebKit bug patch -- see inside...
|
||||||
var img2canvas =
|
var img2canvas =
|
||||||
function({url, orientation, flipped}, callback){
|
function({url, orientation, flipped}, callback){
|
||||||
var img = new Image
|
|
||||||
|
|
||||||
|
|
||||||
// XXX PATCH...
|
// XXX PATCH...
|
||||||
// XXX <canvas>.drawImage(..) seems to take EXIF into account, ignoring
|
// XXX <canvas>.drawImage(..) seems to take EXIF into account, ignoring
|
||||||
// the .imageOrientation setting both the canvas and image are in
|
// the .imageOrientation setting both the canvas and image are in
|
||||||
// DOM and the image needs to be added to dom before .src is set
|
// DOM and the image needs to be added to dom before .src is set
|
||||||
var PATCHED_ELEMENTS
|
var PATCHED_ELEMENTS
|
||||||
var PATCH_BUG = function(e){
|
var PATCH = function(e){
|
||||||
PATCHED_ELEMENTS =
|
PATCHED_ELEMENTS =
|
||||||
PATCHED_ELEMENTS
|
PATCHED_ELEMENTS
|
||||||
|| document.body.appendChild(
|
|| document.body.appendChild(
|
||||||
@ -56,13 +55,13 @@ function({url, orientation, flipped}, callback){
|
|||||||
this.style.opacity = 0
|
this.style.opacity = 0
|
||||||
this.style.overflow = 'hidden' }))
|
this.style.overflow = 'hidden' }))
|
||||||
PATCHED_ELEMENTS.appendChild(e) }
|
PATCHED_ELEMENTS.appendChild(e) }
|
||||||
|
// XXX PATCH...
|
||||||
var CLEANUP_PATCH = function(){
|
var CLEANUP_PATCH = function(){
|
||||||
PATCHED_ELEMENTS
|
PATCHED_ELEMENTS
|
||||||
.parentElement
|
.parentElement
|
||||||
.removeChild(PATCHED_ELEMENTS) }
|
.removeChild(PATCHED_ELEMENTS) }
|
||||||
// XXX END PATCH...
|
|
||||||
|
|
||||||
|
|
||||||
|
var img = new Image
|
||||||
img.onload = function(){
|
img.onload = function(){
|
||||||
var width = this.naturalWidth
|
var width = this.naturalWidth
|
||||||
var height = this.naturalHeight
|
var height = this.naturalHeight
|
||||||
@ -71,7 +70,7 @@ function({url, orientation, flipped}, callback){
|
|||||||
c.style.imageOrientation = 'none'
|
c.style.imageOrientation = 'none'
|
||||||
|
|
||||||
// XXX PATCH...
|
// XXX PATCH...
|
||||||
PATCH_BUG(c)
|
PATCH(c)
|
||||||
|
|
||||||
var ctx = c.getContext('2d')
|
var ctx = c.getContext('2d')
|
||||||
// prepare for rotate...
|
// prepare for rotate...
|
||||||
@ -104,15 +103,16 @@ function({url, orientation, flipped}, callback){
|
|||||||
// prevent the browser from rotating the image via exif...
|
// prevent the browser from rotating the image via exif...
|
||||||
img.style.imageOrientation = 'none'
|
img.style.imageOrientation = 'none'
|
||||||
img.crossOrigin = ''
|
img.crossOrigin = ''
|
||||||
img.src = url
|
|
||||||
|
|
||||||
// XXX PATCH...
|
// XXX PATCH...
|
||||||
PATCH_BUG(img)
|
PATCH(img)
|
||||||
|
|
||||||
|
img.src = url
|
||||||
return img }
|
return img }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
var Widget =
|
var Widget =
|
||||||
|
|||||||
@ -649,11 +649,10 @@ module.Sharp = core.ImageGridFeatures.Feature({
|
|||||||
isApplicable: function(){ return !!sharp },
|
isApplicable: function(){ return !!sharp },
|
||||||
|
|
||||||
handlers: [
|
handlers: [
|
||||||
/* XXX not sure if we need this...
|
/* XXX this needs to be run in the background...
|
||||||
// XXX this is best done in a thread + needs to be abortable...
|
// XXX this is best done in a thread + needs to be abortable (on .load(..))...
|
||||||
['loadImages',
|
['loadImages',
|
||||||
function(){
|
function(){
|
||||||
//this.cacheImageMetadata('all', false) }],
|
|
||||||
this.cacheImageMetadata('all') }],
|
this.cacheImageMetadata('all') }],
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user