Skip to content

Commit

Permalink
add fallback to webkitURL when investigated #130
Browse files Browse the repository at this point in the history
  • Loading branch information
ivictbor committed Apr 14, 2021
1 parent 337d837 commit f1f5460
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@
// window.p2 = Painterro({id: "test-2"}).show()

window.p = Painterro({
hideByEsc: true,
saveByEnter: true,
shadowScale: 1,
// hideByEsc: true,
// saveByEnter: true,
// shadowScale: 1,
id: 'app',
// backplateImgUrl: 'https://images.pexels.com/photos/4386297/pexels-photo-4386297.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',
// toolbarHeightPx: 50,
// buttonSizePx: 42,
// defaultTool: 'arrow',
/* // defaultTool: 'arrow',
onChange: (e) => {console.log('onchange e', e)},
onUndo: (e) => {console.log('onUndo e', e)},
onRedo: (e) => {console.log('onRedo e', e)},
Expand All @@ -104,6 +104,7 @@
onImageFailedOpen: () => {
console.log('open new image');
},
*/
// language: 'ja',
//availableLineWidths: [1,2,4,8,16,64],
//availableEraserWidths: [1,2,4,8,16,64],
Expand All @@ -114,13 +115,13 @@
console.log('saving', saver.getWidth(), saver.getHeight())
console.log('hasAlphaChannel', saver.hasAlphaChannel())
// console.log('Base64', saver.asDataURL())
//done(true);
done(true);
}
//toolbarPosition: 'top',
// fixMobilePageReloader: false,
// defaultTool: 'line',
//hiddenTools: ['line']
}).show()
}).show('https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Gutenberg.jpg/300px-Gutenberg.jpg?12')
const ctx = window.p.ctx;

// ctx.beginPath();
Expand Down
1 change: 1 addition & 0 deletions js/inserter.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export default class Inserter {
this.main.params.onImageFailedOpen();
}
};
// img.crossOrigin = '*';
img.src = source;
if (!empty) {
if (Object.keys(this.activeOption).length !== 1) {
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ class PainterroProc {
return;
}
this.loadedName = trim((f.name || '').replace(/\..+$/, ''));
const dataUrl = URL.createObjectURL(f);
const dataUrl = (window.URL ? window.URL : window.webkitURL).createObjectURL(f);
this.loadImage(dataUrl, f.type);
}

Expand Down

0 comments on commit f1f5460

Please sign in to comment.