ZBLOG

rotat(e) { // this.isRotatShow = true // this.showCanvas = true let rotatCtx = uni.createCanvasContext('rotatCanvas', this); //创建绘图对象 // 重新定位中心点 rotatCtx.translate(0, (this.screenWidth * this.screenWidth) / this.screenHeight); ...

要不旋转图片,只需要将以下两行代码注释掉即可:

  1. rotatCtx.translate(0, (this.screenWidth * this.screenWidth) / this.screenHeight);
  2. rotatCtx.rotate((270 * Math.PI) / 180);

修改后的代码如下所示:

  1. rotat(e) {
  2. // this.isRotatShow = true
  3. // this.showCanvas = true
  4. let rotatCtx = uni.createCanvasContext('rotatCanvas', this); //创建绘图对象
  5. // 将签字图片绘制进入Canvas
  6. rotatCtx.drawImage(e, 0, 0, (this.screenWidth * this.screenWidth) / this.screenHeight, this.screenWidth);
  7. // 保存绘图结果
  8. rotatCtx.draw(true);
  9. setTimeout(() => {
  10. // 生成图片并回调
  11. uni.canvasToTempFilePath({
  12. canvasId: 'rotatCanvas',
  13. success: val => {
  14. console.log('tempFilePath', val.tempFilePath)
  15. this.showCanvas = false
  16. this.$emit('savesign', {
  17. tempFilePath: val.tempFilePath,
  18. flag: true
  19. });
  20. setTimeout(() => {
  21. this.hide();
  22. }, 500);
  23. },
  24. complete: com => {
  25. console.log(com);
  26. }
  27. }, this);
  28. }, 500);
  29. }

这样修改之后,图片就不会进行旋转操作了。记得在使用该函数之前确保rotatCanvas存在且可见。


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=15945

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?