Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
加入“非实时渲染”以解决频繁绘制 canvas 带来的卡顿问题 #55
base: master
Are you sure you want to change the base?
加入“非实时渲染”以解决频繁绘制 canvas 带来的卡顿问题 #55
Changes from all commits
5e5c42a
8843e16
6eeb488
c5cca95
3970b00
b8da0a8
aef5992
2c814fe
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能否有办法避免在库中setData呢,因为这样处理的话,和外部cropperOpt耦合了,能否做成外部的拓展模块,因为imgLeft、imgTop等属性是可以通过实例拿到的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果要在外部 page 中更新 UI 的话,这就可以解决
cropperOpt
耦合的问题了。可以在__oneTouchMove
和__twoTouchMove
中放置两个钩子函数,比如onTouchMove
, 然后开发者在自己的 page 中调用钩子函数来setData
。这样会有个问题:
<image/>
要由开发者去处理。以及<image/>
是放在 template 里,还是开发者自己写在 page 里。更好的方式应该是:开发者在使用 we-cropper 时,只需指定参数和监听事件,其他裁切相关的具体逻辑都无需过问。
如果将
cropperOpt
定义为固定的接口参数,那在 we-cropper 里setData
应该就不是问题。只需在裁切成功、失败以及取消之后,再we-cropper.pageContext = null
来解决循环引用导致的内存泄漏问题。如果以小程序的
component 组件
来实现we-cropper
,是不是会更合适There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里我的考虑是,we-cropper理念还是设计成一个库,最终可以运行在各个平台(框架)上,尽可能脱离宿主上下文环境,目前we-cropper缺乏一套可靠的插件拓展机制,这个是一个必须解决的首要问题。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
更新你的代码以后,跑不起来呀,cropperImageSrc imageTop 这些属性都是获不到值,例子,应该是1.2版本的吧,
Large diffs are not rendered by default.