| | |
| | | objectsContainer2 = new PIXI.Container(); |
| | | pixiApp.stage.addChild(objectsContainer2); |
| | | |
| | | pixiApp.stage.sortableChildren = true; |
| | | objectsContainer.sortableChildren = true; |
| | | objectsContainer2.sortableChildren = true; |
| | | objectsContainer.zIndex = 10; |
| | | objectsContainer2.zIndex = 20; |
| | | |
| | | //*******************拖动画布******************* |
| | | let stageOriginalPos; |
| | | let mouseDownPoint; |
| | |
| | | function createCrnTexture() { |
| | | const g = new PIXI.Graphics(); |
| | | const yTop = Math.round(height * 0.1); |
| | | let deviceWidth = width * 2; |
| | | |
| | | g.beginFill(0x999999); |
| | | g.drawRect(2, yTop, 3, height - yTop - 2); |
| | | g.drawRect(width - 5, yTop, 3, height - yTop - 2); |
| | | g.drawRect(deviceWidth - 5, yTop, 3, height - yTop - 2); |
| | | g.endFill(); |
| | | g.beginFill(0x999999); |
| | | g.drawRect(0, yTop, width, 3); |
| | | g.drawRect(0, yTop, deviceWidth, 3); |
| | | g.endFill(); |
| | | const cabW = Math.round(width * 0.42); |
| | | const cabW = Math.round(deviceWidth * 0.68); |
| | | const cabH = Math.round(height * 0.38); |
| | | const cabX = Math.round((width - cabW) / 2); |
| | | const cabX = Math.round((deviceWidth - cabW) / 2); |
| | | const cabY = Math.round(height * 0.52 - cabH / 2); |
| | | g.beginFill(0x3a78c2); |
| | | g.beginFill(0x245a9a); |
| | | g.drawRect(cabX, cabY, cabW, cabH); |
| | | g.endFill(); |
| | | const winW = Math.round(cabW * 0.6); |
| | |
| | | g.beginFill(0xd0e8ff); |
| | | g.drawRect(winX, winY, winW, winH); |
| | | g.endFill(); |
| | | const forkW = Math.round(width * 0.5); |
| | | const forkW = Math.round(deviceWidth * 0.8); |
| | | const forkH = Math.max(2, Math.round(height * 0.08)); |
| | | const forkX = Math.round((width - forkW) / 2); |
| | | const forkX = Math.round((deviceWidth - forkW) / 2); |
| | | const forkY = cabY + cabH; |
| | | g.beginFill(0x666666); |
| | | g.drawRect(forkX, forkY, forkW, forkH); |
| | | g.endFill(); |
| | | const rt = PIXI.RenderTexture.create({ width: width, height: height }); |
| | | const rt = PIXI.RenderTexture.create({ width: deviceWidth, height: height }); |
| | | pixiApp.renderer.render(g, rt); |
| | | return rt; |
| | | } |
| | |
| | | } else if (item.type == 'crn') { |
| | | if (getDeviceNo(value) == -1) { |
| | | sprite = new PIXI.Sprite(graphicsCrnTrack); |
| | | sprite.zIndex = 0; |
| | | } else { |
| | | sprite = new PIXI.Sprite(graphicsCrn); |
| | | const deviceNo = getDeviceNo(value); |
| | | const taskNo = getTaskNo(value); |
| | | const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 10, fill: '#000000' }); |
| | | const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 12, fill: '#ffffff', stroke: '#000000', strokeThickness: 2 }); |
| | | const txt = taskNo > 0 ? (deviceNo + "(" + taskNo + ")") : String(deviceNo); |
| | | const text = new PIXI.Text(txt, style); |
| | | text.anchor.set(0.5); |
| | |
| | | sprite.addChild(text); |
| | | sprite.textObj = text; |
| | | pixiCrnMap.set(parseInt(deviceNo), sprite); |
| | | sprite.zIndex = 1; |
| | | } |
| | | } else { |
| | | return null; |