Skip to content
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

建议提供是否固定裁剪框的参数 #42

Open
twinklexp opened this issue Jun 11, 2019 · 1 comment
Open

建议提供是否固定裁剪框的参数 #42

twinklexp opened this issue Jun 11, 2019 · 1 comment

Comments

@twinklexp
Copy link

twinklexp commented Jun 11, 2019

重现步骤

  1. 在组件挂载之后,使用this.imageCropper.setCutXY(left, top);修改裁剪框位置{cut_top,cut_left }
  2. 触碰界面(Image元素)触发touchend,在回调_end中,最终调用了setCutCenter方法,使原先的裁剪框位置设置失效变回居中效果

期待的行为
增加固定裁剪框参数 fixCropBox

目前解决办法
注释掉image-cropper.js中的_moveStop方法中的居中代码

//停止移动时需要做的操作
    _moveStop() {
      //清空之前的自动居中延迟函数并添加最新的
      clearTimeout(this.data.TIME_CUT_CENTER);
      /* todo 不要居中重置 */
      /* this.data.TIME_CUT_CENTER = setTimeout(() => {
        //动画启动
        if (!this.data._cut_animation) {
          this.setData({
            _cut_animation: true
          });
        }
        this.setCutCenter();
      }, 1000) */
      //清空之前的背景变化延迟函数并添加最新的
      clearTimeout(this.data.TIME_BG);
      this.data.TIME_BG = setTimeout(() => {
        if (this.data._flag_bright) {
          this.setData({
            _flag_bright: false
          });
        }
      }, 2000)
    }
@lshunran
Copy link

遇到同样的问题,也是同样的需求,建议增加参数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants