描述: 对画布截图, 当图片太大分成2张截图数据, 当第2次调用canvasGetImageData
时
, 如任何反应(success,fail,complete 这个3回调都没日志输入) 。
代码如下: //图形快照
this.Snapshot=function()
{
var self=this;
var width = this.ChartBorder.GetChartWidth();
var height = this.ChartBorder.GetChartHeight();
if (width > 400)
{
width=400;
wx.canvasGetImageData(
{
canvasId: this.ChartBorder.UIElement.ID,
x: 0,
y: 0,
width: width,
height: height,
success(res) {
self.ScreenImageData =
{
Data: res.data,
Info: { X: 0, Y: 0, Width: width, Height: height }
};
console.log("[HQTradeFrame::Snapshot] canvasGetImageData finish. (large image. Page.1)");
console.log(self.ScreenImageData.Info);
}
});
var width2 = self.ChartBorder.GetChartWidth() - width;
var x = width;
wx.canvasGetImageData(
{
canvasId: self.ChartBorder.UIElement.ID,
x: x,
y: 0,
width: width,
height: height,
success(res) {
self.ScreenImageData2 =
{
Data: res.data,
Info: { X: x, Y: 0, Width: width2, Height: height }
};
console.log("[HQTradeFrame::Snapshot] canvasGetImageData finish. (large image. Page.2)");
console.log(self.ScreenImageData2.Info);
},
fail(res) {
console.log("[HQTradeFrame::Snapshot] canvasGetImageData finish. (large image. Page.2)");
},
complete(res){
console.log("[HQTradeFrame::Snapshot] canvasGetImageData finish. (large image. Page.2)");
}
});
}
else
{
self.ScreenImageData2 = null;
wx.canvasGetImageData(
{
canvasId: this.ChartBorder.UIElement.ID,
x: 0,
y: 0,
width: width,
height: height,
success(res) {
self.ScreenImageData =
{
Data: res.data,
Info: { X: 0, Y: 0, Width: width, Height: height }
};
console.log("[HQTradeFrame::Snapshot] canvasGetImageData finish. (small image)");
console.log(self.ScreenImageData.Info);
}
});
}
}