chanind / hanzi-writer-miniprogram

Wechat Miniprogram plugin for Hanzi Writer (微信小程序组件)
https://chanind.github.io/hanzi-writer
MIT License
85 stars 25 forks source link

Finally! Half done! About display problems!(最终,搞定一半!关于显示问题!) #52

Closed xjh093 closed 2 years ago

xjh093 commented 2 years ago

I modified this file:

file:miniprogram_npm/hanzi-writer-miniprogram/index.js method:var RenderTarget = function () { // xxxxx }

  function RenderTarget(view) {
    _classCallCheck(this, RenderTarget);

    this.view = view;
    this.eventEmitter = new _EventEmitter2.default();
    //this.ctx = polyfillCanvasCtx(wx.createCanvasContext('writer-canvas', view));
    //this.canvas = this.view.selectComponent('#writer-canvas');

    const query = wx.createSelectorQuery().in(view);
    query.select('#writer-canvas')
         .fields({ node: true, size: true })
     .exec((res) => {
            console.log("res1");
            console.log(res);
            console.log("res2");

            this.canvas = res[0].node;
            //this.ctx = polyfillCanvasCtx(this.canvas.getContext('2d'));
            this.ctx = this.canvas.getContext('2d');
         });
  }

截屏2021-11-19 下午2 04 41 2

but, there is a problem its display:

截屏2021-11-19 下午2 11 38
xjh093 commented 2 years ago

base lib: 2.21.0

xjh093 commented 2 years ago

Resolved, waiting for author merge pr 53