buuing / lucky-canvas

🎖🎖🎖 基于 TS + Canvas 开发的【大转盘 / 九宫格 / 老虎机】抽奖插件,🌈 一套源码适配多端框架 JS / Vue / React / Taro / UniApp / 微信小程序等,🎨 奖品 / 文字 / 图片 / 颜色 / 按钮均可配置,支持同步 / 异步抽奖,🎯 概率前 / 后端可控,🚀 自动根据 dpr 调整清晰度适配移动端
https://100px.net
Apache License 2.0
7.82k stars 945 forks source link

大转盘出现奇怪的形状,不知是哪里配置错了 #278

Closed elfman closed 2 years ago

elfman commented 2 years ago

image

// 代码开始, 别再放歪了行吗

// 代码结束
elfman commented 2 years ago

修改node_modules里的lucky-wheel.vue源码,在LuckyWheel的初始化参数里,添加beforeDraw, afterDraw两个回调函数,执行ctx.translate后显示正常了。但这肯定不是长久的解决方法,不知这是bug,还是我哪里配错了?

beforeDraw: function () {
  ctx.translate(Radius, Radius)
},
afterDraw: function () {
  ctx.translate(-Radius, -Radius)
},
buuing commented 2 years ago

你是uniapp编译的h5?

elfman commented 2 years ago

是的

buuing commented 2 years ago

修改ctx.translate是我以前的方案, 我不知道你从哪看到的, 因为后面我看到编译正常了就删掉了, 建议你检查一下你的hbx版本

buuing commented 2 years ago

这个是一个uniapp的渲染bug, 他会在图片onload之后重置圆心

elfman commented 2 years ago
"@dcloudio/types": "*",
"@dcloudio/uni-automator": "^2.0.0-28620200814003",
"@dcloudio/uni-cli-i18n": "^2.0.0-32920210927002",
"@dcloudio/uni-cli-shared": "^2.0.0-28620200814003",
"@dcloudio/uni-i18n": "^2.0.0-32920210927002",
"@dcloudio/uni-migration": "^2.0.0-28620200814003",
"@dcloudio/uni-template-compiler": "^2.0.0-28620200814003",
"@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.0-28620200814003",
"@dcloudio/vue-cli-plugin-uni": "^2.0.0-28620200814003",
"@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.0-28620200814003",
"@dcloudio/webpack-uni-mp-loader": "^2.0.0-28620200814003",
"@dcloudio/webpack-uni-pages-loader": "^2.0.0-28620200814003",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-plugin-import": "^1.11.0",
"cross-env": "^7.0.2",
"eslint": "^7.7.0",
"eslint-plugin-vue": "^6.2.2",
"jest": "^25.4.0",
"less-loader": "^6.2.0",
"mini-types": "*",
"miniprogram-api-typings": "*",
"postcss-comment": "^2.0.0",
"sass-resources-loader": "^2.1.0",
"vma-assist": "^1.0.52",
"vue-template-compiler": "^2.6.11"
elfman commented 2 years ago

我是用命令行编译的,并没有使用HBuilderX

buuing commented 2 years ago

哦, 那你用cli重新创建一个项目试试, 因为uniapp已经修复过这个问题了

如果新项目可以, 建议你按照新项目的依赖版本去升级一下旧项目

elfman commented 2 years ago

把uniapp所有相关的包都升级到 2.0.1-34720220422002 后就正常了

buuing commented 2 years ago

ok, 新版是好的