feat: 完成绘制汉字基础功能

This commit is contained in:
R524809
2025-10-17 17:48:34 +08:00
parent 7ac81eb961
commit 2734b9de9e
18 changed files with 16428 additions and 299 deletions
+8 -3
View File
@@ -12,6 +12,7 @@ Page({
data: {
cardList: [] as CardList,
selectedWords: [] as string[],
showColorPopup: false,
currentKey: 0,
currentColor: '',
@@ -43,6 +44,7 @@ Page({
{ color: '#FFFF00', word: '迎' },
{ color: '#8A2BE2', word: '您' },
],
selectedWords: ['涂', '鸦', '丫', '欢', '迎', '您'],
showIntroductionPopup: true,
env: getApp().globalData.env || 'release',
});
@@ -69,8 +71,8 @@ Page({
const boxWidth = rect.width;
const boxHeight = boxWidth / (width / height);
this.boxHeight = boxHeight;
this.boxWidth = boxWidth;
console.log('boxWidth----:', boxWidth)
console.log('boxHeight----:', boxHeight)
// 然后初始化canvas
wx.createSelectorQuery()
@@ -108,7 +110,10 @@ Page({
callback: () => void = () => { },
) {
if (updatedCardList) {
this.setData({ cardList: updatedCardList }, () => {
this.setData({
cardList: updatedCardList,
selectedWords: updatedCardList.map((item) => item.word)
}, () => {
// 如果cardList有内容且canvas未初始化,先初始化canvas
if (!this.canvas) {
this.initCanvas();
+1 -1
View File
@@ -84,7 +84,7 @@
bind:onChange="onChangeColor" />
<word-picker
show="{{showSelectWordPopup}}"
cardList="{{cardList}}"
selectedWords="{{cardList}}"
bind:onClose="closeSelectWordPopup"
bind:onChange="onChangeWord" />
</view>