ios橡皮擦效果不行,安卓和模拟器正常



// pages/test.js

Page({

/**

  * 页面的初始数据

  */

data: {

windowWidth: 0,

windowHeight: 0,

s: 0,

x1: 0,

y1: 0,

xx1: 100,

yy1: 50,

a: 20,

jiange: 20,

timeout: 0,

totimes: 100,

ctx: null,

cpw: 0,

cph: 0,

dd:0

},


/**

  * 生命周期函数--监听页面加载

  */

onLoad: function (options) {

const self = this;

wx.getSystemInfo({

success: function (res) {

console.log(res);

let s = res.windowWidth / 750;

let cpw = 0;//148 * s / 2;

let cph = 156 * s * .8;

let x1 = 560 * s;

let y1 = 240 * s;


self.setData({

windowWidth: res.windowWidth,

windowHeight: res.windowHeight,

s: s,

cpw: cpw,

cph: cph,

x1: x1,

y1: y1,

xx1: x1,

yy1: y1


});

}

})



},

/**

  * 生命周期函数--监听页面初次渲染完成

  */

onReady: function () {

this.ctx = wx.createCanvasContext("mycanvas", this);

let s = this.data.s;

this.ctx.drawImage("index/images/qz.png", 60 * s, 274 * s, 672 * s, 504 * s);

this.ctx.draw();

},

//事件处理函数

bindtouchstart: function (e) {

if (this.ctx == null) return;

clearTimeout(this.data.timeout);

let xx1 = e.touches[0].x - this.data.cpw;

let yy1 = e.touches[0].y - this.data.cph;

this.setData({

x1: e.touches[0].x,

y1: e.touches[0].y,

xx1: xx1,

yy1: yy1

});




this.ctx.save();

this.ctx.beginPath();

this.ctx.arc(this.data.x1, this.data.y1, this.data.a, 0, 2 * Math.PI);

this.ctx.clip()

this.ctx.clearRect(0, 0, this.data.windowWidth, this.data.windowHeight);

this.ctx.restore();

this.ctx.draw(true);

},

bindtouchmove: function (e) {

if (this.ctx == null) return;

let x2 = e.touches[0].x;

let y2 = e.touches[0].y;

let asin = this.data.a * Math.sin(Math.atan((y2 - this.data.y1) / (x2 - this.data.x1)));

let acos = this.data.a * Math.cos(Math.atan((y2 - this.data.y1) / (x2 - this.data.x1)));

let x3 = this.data.x1 + asin;

let y3 = this.data.y1 - acos;

let x4 = this.data.x1 - asin;

let y4 = this.data.y1 + acos;

let x5 = x2 + asin;

let y5 = y2 - acos;

let x6 = x2 - asin

展开全部
收起
2回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • Black&RED

    9人对此回答表示赞同

    没明白问题是什么,另外,如果怀疑是接口有bug,请提供相关的代码片段,我们定位下问题

    展开
    9
    0回复
    发布于 5年前

    评论(0)

    收起评论

  • Raimundo

    1人对此回答表示赞同

    好的,谢谢。这个问题应该帧率过低

    展开
    1
    0回复
    发布于 5年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部