问题描述
我在Ionic 3 Angle V5上,我无法使用返回未定义的Viewchild,所以我使用ViewChildren et获取数组的第一项(我知道是肮脏的)
proc sgplot data= miles;
title "Cumulative Miles Driven by Number of Individuals"
histogram CumulativeMiles/scale= count
fillattrs=(color=blue);
xaxis values= (0 to 1000 by 100)
label= "Cumulatve Miles Driven"
yaxis values= (0 to 50000 by 10000)
label= "Number of Individuals";
run;
当我画一条线时,我松开按钮,然后再次绘制将删除先前的绘制
解决方法
重置2D上下文状态
设置画布大小时,2D状态将重置为默认值。这包括所有像素,这些像素均设置为默认的transparent
(如果获取上下文时使用black
,则设置为默认的{alpha: false}
。
此外,所有2D设置(例如fillStyle
,font
,transform
等)都重置为默认值。
通过ctx.save
保存的任何状态也将被删除。
任何对画布width
或height
属性的写入都会发生这种情况。
例如以下内容将重置画布状态。
canvas.width = canvas.width;
在通话startDrawing
中,您设置了画布width
和height
,这就是在每次鼠标按下事件时都会清除画布的原因。