Skip to content
Permalink
Browse files

feat(imgCanvas): fix "create material/wdb snapshot": now clear img ca…

…nvas before draw

update wonder.js, wonder-webgl version
  • Loading branch information...
yyc-git committed May 24, 2019
1 parent ccdfc4f commit 245be64972ebff4feebff148e3a4eefccca67b4b
Showing with 12 additions and 2 deletions.
  1. +1 −0 .cz-config.js
  2. +2 −2 package.json
  3. +8 −0 src/core/external/type/CanvasType.re
  4. +1 −0 src/core/utils/canvas/ImgCanvasUtils.re
@@ -15,6 +15,7 @@ module.exports = {
],

scopes: [
{ name: "imgCanvas" },
{ name: "asset-bundle" },
{ name: "script" },
{ name: "language" },
@@ -74,11 +74,11 @@
"wonder-commonlib": "^0.2.32",
"wonder-hotkey": "^0.0.1",
"wonder-log": "^0.2.11",
"wonder.js": "1.1.0-alpha.5"
"wonder.js": "1.1.0-alpha.6"
},
"resolutions": {
"wonder-log": "^0.2.11",
"wonder-webgl": "^0.0.9",
"wonder-webgl": "^0.0.10",
"wonder-bs-sinon": "0.1.9",
"component-classes": "1.2.5",
"wonder-commonlib": "0.2.32",
@@ -43,6 +43,14 @@ let drawImage:
|j}
];

let clearRect: (context, Dom.element) => context = [%raw
(canvasContext, canvasDom) => {j|
canvasContext.clearRect(0, 0, canvasDom.width, canvasDom.height);

return canvasContext;
|j}
];

let toDataURL: Dom.element => string = [%raw
canvasDom => {j|
return canvasDom.toDataURL();
@@ -41,6 +41,7 @@ let _drawImgCanvasSnapshot =
let _clipTargetCanvasSnapshot = (targetCanvasDom, imgCanvasDom, editorState) => {
editorState
|> ImgContextImgCanvasEditorService.unsafeGetImgContext
|> CanvasType.clearRect(_, imgCanvasDom)
|> _drawImgCanvasSnapshot(
_,
targetCanvasDom,

0 comments on commit 245be64

Please sign in to comment.
You can’t perform that action at this time.