drawError(data, index) {
let that = this
let errorBox = new this.myPaper.Raster({
source: require("../images/errorBox.png"),
errorBox.bounds.x = data.x
errorBox.bounds.y = data.y - 40
if (data.isError) {
var rectangle = new this.myPaper.Rectangle({ x: data.x - 20, y: data.y - 73 }, new paper.Size(100, 30));
var cornerSize = new this.myPaper.Size(6, 6);
var errorBorder = new this.myPaper.Path.Rectangle(rectangle, cornerSize);
errorBorder.strokeWidth = 1;
errorBorder.strokeColor = '#A8BFF1';
errorBorder.fillColor = '#0F1C3E';
console.log(errorBorder, 'errorBorder')
errorBorder.onMouseUp = function () {
that.robotData[index].isShow = !that.robotData[index].isShow
new this.myPaper.Raster({
source: require("../images/error.png"),
position: { x: data.x + 28, y: data.y - 13 }
var stateNameTxt = new this.myPaper.PointText(data.x - 5, data.y - 53);
stateNameTxt.content = '待人工处理';
stateNameTxt.fillColor = '#3EE1FF'
stateNameTxt.fontSize = '14px'
stateNameTxt.onMouseUp = function () {
that.robotData[index].isShow = !that.robotData[index].isShow
其他简单的元素很多都是一样的,甚至都用UI小姐姐给的图片绘制上去。
其中有一个元素需要进行移动。由于业务性比较强,所以下面代码不完善展示了,只是讲思路。
想要让一个整体进行移动,于是采用了创建一个Group,将元素都添加到Group中,给Group设置动画onFrame 即可,让动画停止return。