baijunjie / PhotoClip.js

一款手势驱动的裁图插件 / A gesture to drive image cropping plug-in
MIT License
638 stars 216 forks source link

选择多次后报错 "photoclip": "^3.3.6", #72

Closed haoyinag closed 6 years ago

haoyinag commented 6 years ago

场景:Chrome 动作:弹窗的content中初始化,然后裁剪,done之后执行clear();如此执行两次以上次数会多次但不一定报错。 报错信息: Photoclip.js?d47c:1282 Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)' at _class._clipImg (Photoclip.js?d47c:1282) at HTMLAnchorElement.proxy (Photoclip.js?d47c:278) 结论:然而貌似不影响功能。

(还有一个问题:为什么要先在容器内放一张图片(标签),然后才能以这张图片为蓝本初始化呢?)

haoyinag commented 6 years ago

而且报错信息会累加,比如第一次报一次错,第二次报3次错,第三次报6次错; 是clear()的问题吗?

baijunjie commented 6 years ago

@haoyinag 嗨,我修改了一些不严谨的代码,你可以尝试一下 v3.3.7,如果仍然有问题,请重新打开这个 issue

haoyinag commented 6 years ago

v3.3.7出现新的错误 npm提示错误信息:

Module parse failed: Unexpected token (420:16) You may need an appropriate loader to handle this file type. }
_rotateCW90 = (e) => {
this._rotateBy(90, this._iScroll.options.bounceTime, { x: e.clientX, y: e.clientY });
};
haoyinag commented 6 years ago

有没有一个稳定版可以先用着呢

baijunjie commented 6 years ago

@haoyinag 好像是你的 babel 配置不能够支持 transform-class-properties 不过我还是更新了代码,尽量不使用非常规的书写方式,你可以尝试一下

haoyinag commented 6 years ago

@baijunjie 如果我这边手动添加支持,我该怎么做 +_+

baijunjie commented 6 years ago

@haoyinag 网上能搜到关于这个插件的配置方法,不过不用过于纠结这个,v3.3.8 不需要他了

haoyinag commented 6 years ago

@baijunjie nice