From f93f0490786fb82d232155d4151d6230f92de208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sat, 6 Feb 2021 12:02:07 +0800 Subject: [PATCH 1/9] =?UTF-8?q?1.0.19=20=E6=96=B0=E5=A2=9E=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E8=83=8C=E6=99=AF=E5=9B=BE=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/working-area.component.ts | 265 +++++++++--------- 1 file changed, 134 insertions(+), 131 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 1c8b610..caa4486 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -158,7 +158,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。 * Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。 */ - public VERSION = '1.0.18.20210205_beta'; + public VERSION = '1.0.19.20210206_beta'; /** * 数据初始化 */ @@ -201,9 +201,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (this.allowEdit && this.canvasData.gameMode === axShape.assetData.GameMode) { // 删除图例对象 const temp = this.backgroundImage.getChildByName('图例') as AxLegend; - if ( temp !== undefined + if (temp !== undefined && temp !== null - && axShape.assetData.Name !== '图例') { + && axShape.assetData.Name !== '图例') { const itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); temp.deleteItem(itemLegend); } @@ -241,15 +241,15 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV sayHello() { let _a; if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { - const args = [ - '\n %c 版本号 - ' + this.VERSION + '\n', - 'color: #ff66a5; background: #000000; padding:5px 0;', - ]; - (_a = window.console).log.apply(_a, args); + const args = [ + '\n %c 版本号 - ' + this.VERSION + '\n', + 'color: #ff66a5; background: #000000; padding:5px 0;', + ]; + (_a = window.console).log.apply(_a, args); } else if (window.console) { - window.console.log('\n %c 版本号 - ' + this.VERSION + '\n'); + window.console.log('\n %c 版本号 - ' + this.VERSION + '\n'); } -} + } /** * 页面初始化 */ @@ -305,8 +305,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV public resizeItem(size: number) { this.backgroundImage.children.forEach(item => { if (item instanceof AxShape) { - item.setItemScale(size); - item.drawBorder(size); + item.setItemScale(size); + item.drawBorder(size); } }); } @@ -353,18 +353,18 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.camera2D .clamp({ - left: -10000, - right: 10000, - top: -10000, - bottom: 10000, - }) + left: -10000, + right: 10000, + top: -10000, + bottom: 10000, + }) .drag() .pinch() .wheel() .clampZoom({ - minScale: 0.12, - maxScale: 16, - }) + minScale: 0.12, + maxScale: 16, + }) .decelerate(); this.camera2D.on('wheel', event => { @@ -373,7 +373,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.camera2D.on('pointerdown', event => { if (this.isCtrlKeyClicked === true - && event.data.button === 0) { + && event.data.button === 0) { this.rectToolGraphics.visible = true; this.initialScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); @@ -384,7 +384,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.rectToolGraphics.visible = false; const shapes: AxShape[] = []; this.backgroundImage.children.forEach(item => { - if ( item instanceof AxShape + if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { // 判断2个矩形是否相交 const rect1 = this.rectToolGraphics.getBounds(); @@ -403,7 +403,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.rectToolGraphics.visible = false; const shapes: AxShape[] = []; this.backgroundImage.children.forEach(item => { - if ( item instanceof AxShape + if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { // 判断2个矩形是否相交 const rect1 = this.rectToolGraphics.getBounds(); @@ -419,7 +419,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV }); this.camera2D.on('pointermove', event => { if (this.isCtrlKeyClicked === true - && this.rectToolGraphics.visible === true) { + && this.rectToolGraphics.visible === true) { this.finalScreenMousePos = this.backgroundImage.toLocal(this.mousePosition); const init = this.initialScreenMousePos; @@ -561,9 +561,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } } const temp = this.backgroundImage.getChildByName('图例') as AxLegend; - if ( temp !== undefined + if (temp !== undefined && temp !== null - && axShape.assetData.Name !== '图例') { + && axShape.assetData.Name !== '图例') { const itemLegend = new Legend(axShape.assetData.Name, axShape.assetData.ImageUrl, 1); temp.addItem(itemLegend); } @@ -660,7 +660,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV wall.allowEdit = this.allowEdit && this.canvasData.gameMode === wall.assetData.GameMode; } break; - } + } }); // this.emit('backgroundScale', this.backgroundImage.scale.x); } @@ -689,7 +689,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const pipeline = new AxArrowConnector(nodeData[key][tempKey], this, false, true); pipeline.allowEdit = this.allowEdit && this.canvasData.gameMode === pipeline.assetData.GameMode; break; - } + } }); }); } @@ -701,7 +701,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.enterPaintEndButton.width = 60; this.enterPaintEndButton.height = 60; this.enterPaintEndButton.anchor.set(0.5); - this.enterPaintEndButton.position = new PIXI.Point(0, 0); + this.enterPaintEndButton.position = new PIXI.Point(0, 0); this.enterPaintEndButton.interactive = true; this.enterPaintEndButton.buttonMode = true; this.enterPaintEndButton @@ -737,7 +737,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV list.push(property); }); - const assetData = { + const assetData = { TemplateId: this.canvasData.selectTemplateData.id, CanConnect: this.canvasData.selectTemplateData.canConnect, Pipelines: new Array(), @@ -748,19 +748,19 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV FillMode: this.canvasData.selectTemplateData.fillMode, FireElementId: this.canvasData.selectTemplateData.fireElementId, FixedSize: this.canvasData.selectTemplateData.fixedSize, - Height : 32, - Width : 32, + Height: 32, + Width: 32, Id: ObjectID.default.generate(), ImageUrl: this.canvasData.selectTemplateData.imageUrl, InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, - MultiPoint : null, + MultiPoint: null, Point: new PIXI.Point(this.previewImage.x, this.previewImage.y), - Name : this.canvasData.selectTemplateData.name, + Name: this.canvasData.selectTemplateData.name, PropertyInfos: list, - Border : this.canvasData.selectTemplateData.border, - DrawMode : this.canvasData.selectTemplateData.drawMode, - Thickness : this.canvasData.selectTemplateData.thickness, - IsFromBuilding : this.canvasData.selectTemplateData.isFromBuilding, + Border: this.canvasData.selectTemplateData.border, + DrawMode: this.canvasData.selectTemplateData.drawMode, + Thickness: this.canvasData.selectTemplateData.thickness, + IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, GameMode: this.canvasData.gameMode, Tag: this.canvasData.selectTemplateData.tag }; @@ -860,61 +860,61 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // this.paintingShape.refresh(); // } // } else { - this.previewLineSegment.visible = true; - this.enterPaintEndButton.position = this.circleShadow.position; - this.enterPaintEndButton.visible = true; - this.enterPaintEndButton.zIndex = this.backgroundImage.children.length; - this.currentClickPoint.position = new PIXI.Point(this.circleShadow.x, this.circleShadow.y); - this.paintPoints.push(new PIXI.Point(this.circleShadow.x, this.circleShadow.y)); - if (this.paintPoints.length < 2) { - return; - } - if (this.paintingShape === null) { - const jsonObject = JSON.parse(JSON.stringify(this.canvasData.selectTemplateData.propertyInfos)); - const propertyList = []; - jsonObject.forEach(element => { - const property = new PropertyInfo(element); - propertyList.push(property); - }); - const assetData2 = { - TemplateId: this.canvasData.selectTemplateData.id, - FloorId: this.canvasData.selectStorey.id, - Angle: this.canvasData.selectTemplateData.angle, - Color: this.canvasData.selectTemplateData.color, - Enabled: this.canvasData.selectTemplateData.enabled, - FillMode: this.canvasData.selectTemplateData.fillMode, - FireElementId: this.canvasData.selectTemplateData.fireElementId, - FixedSize: this.canvasData.selectTemplateData.fixedSize, - Height: 32, - Width: 32, - Id: ObjectID.default.generate(), - ImageUrl: this.canvasData.selectTemplateData.imageUrl, - InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, - MultiPoint: JSON.parse(JSON.stringify(this.paintPoints)), - Point: new PIXI.Point(0, 0), - Name: this.canvasData.selectTemplateData.name, - PropertyInfos: propertyList, - Border: this.canvasData.selectTemplateData.border, - DrawMode: this.canvasData.selectTemplateData.drawMode, - Thickness: this.canvasData.selectTemplateData.thickness, - IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, - GameMode: this.canvasData.gameMode, - Tag: this.canvasData.selectTemplateData.tag - }; - if (this.canvasData.selectTemplateData.name === '距离') { - this.paintingShape = new AxArrowConnector(assetData2, this, true, true); - } else if (this.canvasData.selectTemplateData.name === '普通墙' || this.canvasData.selectTemplateData.name === '承重墙') { - this.paintingShape = new AxArrowConnector(assetData2, this, false, false); - } else if (this.canvasData.selectTemplateData.name === '水带' ) { - this.paintingShape = new AxArrowConnector(assetData2, this, false, true); - } - } else { - this.paintingShape.assetData.MultiPoint = JSON.parse(JSON.stringify(this.paintPoints)); - this.paintingShape.redraw(); + this.previewLineSegment.visible = true; + this.enterPaintEndButton.position = this.circleShadow.position; + this.enterPaintEndButton.visible = true; + this.enterPaintEndButton.zIndex = this.backgroundImage.children.length; + this.currentClickPoint.position = new PIXI.Point(this.circleShadow.x, this.circleShadow.y); + this.paintPoints.push(new PIXI.Point(this.circleShadow.x, this.circleShadow.y)); + if (this.paintPoints.length < 2) { + return; + } + if (this.paintingShape === null) { + const jsonObject = JSON.parse(JSON.stringify(this.canvasData.selectTemplateData.propertyInfos)); + const propertyList = []; + jsonObject.forEach(element => { + const property = new PropertyInfo(element); + propertyList.push(property); + }); + const assetData2 = { + TemplateId: this.canvasData.selectTemplateData.id, + FloorId: this.canvasData.selectStorey.id, + Angle: this.canvasData.selectTemplateData.angle, + Color: this.canvasData.selectTemplateData.color, + Enabled: this.canvasData.selectTemplateData.enabled, + FillMode: this.canvasData.selectTemplateData.fillMode, + FireElementId: this.canvasData.selectTemplateData.fireElementId, + FixedSize: this.canvasData.selectTemplateData.fixedSize, + Height: 32, + Width: 32, + Id: ObjectID.default.generate(), + ImageUrl: this.canvasData.selectTemplateData.imageUrl, + InteractiveMode: this.canvasData.selectTemplateData.interactiveMode, + MultiPoint: JSON.parse(JSON.stringify(this.paintPoints)), + Point: new PIXI.Point(0, 0), + Name: this.canvasData.selectTemplateData.name, + PropertyInfos: propertyList, + Border: this.canvasData.selectTemplateData.border, + DrawMode: this.canvasData.selectTemplateData.drawMode, + Thickness: this.canvasData.selectTemplateData.thickness, + IsFromBuilding: this.canvasData.selectTemplateData.isFromBuilding, + GameMode: this.canvasData.gameMode, + Tag: this.canvasData.selectTemplateData.tag + }; + if (this.canvasData.selectTemplateData.name === '距离') { + this.paintingShape = new AxArrowConnector(assetData2, this, true, true); + } else if (this.canvasData.selectTemplateData.name === '普通墙' || this.canvasData.selectTemplateData.name === '承重墙') { + this.paintingShape = new AxArrowConnector(assetData2, this, false, false); + } else if (this.canvasData.selectTemplateData.name === '水带') { + this.paintingShape = new AxArrowConnector(assetData2, this, false, true); } + } else { + this.paintingShape.assetData.MultiPoint = JSON.parse(JSON.stringify(this.paintPoints)); + this.paintingShape.redraw(); + } // } // this.emit('backgroundScale', this.backgroundImage.scale.x); - break; + break; } } // else if (this.isCtrlKeyClicked === true) { @@ -934,13 +934,13 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV }) .on('pointerover', (event) => { if (this.previewImage !== null - && this.paintMode === PaintMode.singlePointIcon) { + && this.paintMode === PaintMode.singlePointIcon) { this.previewImage.visible = true; } }) .on('pointerout', (event) => { if (this.previewImage !== null - && this.paintMode === PaintMode.singlePointIcon) { + && this.paintMode === PaintMode.singlePointIcon) { this.previewImage.visible = false; } }); @@ -974,7 +974,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 刷新背景图 */ - public async refreshBackgroundImage(imageUrl: string = this.canvasData.selectStorey.imageUrl, imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise { + public async refreshBackgroundImage( + imageUrl: string = this.canvasData.selectStorey.imageUrl, + imageAngle: number = this.canvasData.selectStorey.imageAngle, + imageWidth: number = this.canvasData.selectStorey.imageWidth, + imageHeight: number = this.canvasData.selectStorey.imageHeight, + ): Promise { if (imageAngle === undefined || imageAngle === null) { imageAngle = 0; } @@ -987,13 +992,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.backgroundImage.x = this.backgroundImage.width / 2; this.backgroundImage.y = this.backgroundImage.height / 2; this.backgroundImage.angle = imageAngle; + this.backgroundImage.width = imageWidth; + this.backgroundImage.height = imageHeight; + this.resetCamera2D(); - // this.backgroundImage.children.forEach((item) => { - // if (item instanceof AxShape) { - // item.refresh(); - // } - // }); } /** * 刷新 @@ -1007,7 +1010,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { - itemList.push(item.name); + itemList.push(item.name); } }); @@ -1037,7 +1040,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { - itemList.push(item.name); + itemList.push(item.name); } }); @@ -1077,17 +1080,17 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV GameMode: this.canvasData.gameMode, PropertyInfos: [ { - Tag : '', - Order : 0, - Enabled : true, - Visible : true, - Required : false, - RuleName : '', - RuleValue : '', - PhysicalUnit : '', - PropertyName : '列', - PropertyType : 2, - PropertyValue : 2, + Tag: '', + Order: 0, + Enabled: true, + Visible: true, + Required: false, + RuleName: '', + RuleValue: '', + PhysicalUnit: '', + PropertyName: '列', + PropertyType: 2, + PropertyValue: 2, }, ], Scale: 1, @@ -1102,10 +1105,10 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } else { if (item !== '图例') { shapeMap.set(this.canvasData.originaleveryStoreyData.data[item].Name, new Legend( - this.canvasData.originaleveryStoreyData.data[item].Name, - this.canvasData.originaleveryStoreyData.data[item].ImageUrl, - 1 - )); + this.canvasData.originaleveryStoreyData.data[item].Name, + this.canvasData.originaleveryStoreyData.data[item].ImageUrl, + 1 + )); } else { data = this.canvasData.originaleveryStoreyData.data[item]; } @@ -1172,7 +1175,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.previewLineSegment.clear(); this.previewLineSegment.lineStyle(1 / this.backgroundImage.scale.x, 0x00ff00, 1); this.previewLineSegment.moveTo(pointA.x, pointA.y); - this.previewLineSegment.lineTo(pointB.x, pointB.y ); + this.previewLineSegment.lineTo(pointB.x, pointB.y); } /** * 创建半径图标影子 @@ -1249,7 +1252,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.previewImage.visible = false; } // 重置组件状态 - if ( this.paintingIcon !== undefined + if (this.paintingIcon !== undefined && this.paintingIcon !== null) { this.backgroundImage.removeChild(this.paintingIcon); } @@ -1333,9 +1336,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } break; case PaintMode.Pipeline: - this.emit('createIcon', this.paintingShape); - this.paintingShape = null; - break; + this.emit('createIcon', this.paintingShape); + this.paintingShape = null; + break; } this.paintPoints.splice(0, this.paintPoints.length); } @@ -1343,11 +1346,11 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 复制 */ public copy(): void { - this.copyData = []; - this.selection.all().forEach(item => { - const newData = JSON.parse(JSON.stringify(item.assetData)); - this.copyData.push(newData); - }); + this.copyData = []; + this.selection.all().forEach(item => { + const newData = JSON.parse(JSON.stringify(item.assetData)); + this.copyData.push(newData); + }); } /** * 粘贴 @@ -1359,7 +1362,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV item.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); const newData = JSON.parse(JSON.stringify(item)); newData.Id = ObjectID.default.generate(), - newData.CompanyId = companyId; + newData.CompanyId = companyId; newData.BuildingId = buildingId; newData.FloorId = floorId; newData.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); @@ -1417,7 +1420,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { - itemList.push(item.name); + itemList.push(item.name); } }); @@ -1446,7 +1449,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { - itemList.push(item.name); + itemList.push(item.name); } }); @@ -1474,7 +1477,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const itemList = []; this.backgroundImage.children.forEach(item => { if (item instanceof AxShape && item instanceof AxPreviewImageShape === false) { - itemList.push(item.name); + itemList.push(item.name); } }); @@ -1532,7 +1535,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV this.selection.addArray(shape); this.selection.all().forEach(item => { this.setSelectEffect(item); - }); + }); AxMessageSystem.send(EVENT_SELECTION_CHANGED); } } @@ -1549,7 +1552,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV } this.selection.addArray(shape); this.selection.all().forEach(item => { - this.setSelectEffect(item); + this.setSelectEffect(item); }); AxMessageSystem.send(EVENT_SELECTION_CHANGED); } From 38b7dd322271025389e1ff24ec99c35b033156ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sat, 6 Feb 2021 12:16:01 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E9=99=90=E5=88=B6=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F1*1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/working-area/working-area.component.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index caa4486..f458f80 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -983,6 +983,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (imageAngle === undefined || imageAngle === null) { imageAngle = 0; } + if (imageWidth === undefined || imageWidth === null || imageWidth === 0) { + imageWidth = 1; + } + if (imageHeight === undefined || imageHeight === null || imageHeight === 0) { + imageHeight = 1; + } this.backgroundImage.scale.set(1); if (imageUrl === undefined || imageUrl === null || imageUrl === '') { this.backgroundImage.texture = this.backgroundTexture; From 368c920d8deb2862a255486ca84197b9df5b1aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sun, 7 Feb 2021 10:10:03 +0800 Subject: [PATCH 3/9] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=BA=95=E5=9B=BE=E5=A4=A7=E5=B0=8F=E5=90=8E=E4=BC=9A=E5=AF=B9?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=80=82=E5=BA=94=E7=BC=A9=E6=94=BE=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E9=94=99=E8=AF=AF=E7=9A=84=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/working-area.component.ts | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index f458f80..207aa14 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -158,7 +158,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。 * Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。 */ - public VERSION = '1.0.19.20210206_beta'; + public VERSION = '1.0.20.20210207_beta'; /** * 数据初始化 */ @@ -468,8 +468,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 缩放适应 */ public zoomFit() { - const imageWidth = this.backgroundImage.texture.width; - const imageHeight = this.backgroundImage.texture.height; + const imageWidth = this.backgroundImage.width; + const imageHeight = this.backgroundImage.height; const appWidth = this.app.view.width - 470; const appHeight = this.app.view.height; const wScale = appWidth / imageWidth; @@ -983,24 +983,32 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (imageAngle === undefined || imageAngle === null) { imageAngle = 0; } - if (imageWidth === undefined || imageWidth === null || imageWidth === 0) { - imageWidth = 1; - } - if (imageHeight === undefined || imageHeight === null || imageHeight === 0) { - imageHeight = 1; - } this.backgroundImage.scale.set(1); + // this.backgroundImage.pivot.set(0); if (imageUrl === undefined || imageUrl === null || imageUrl === '') { this.backgroundImage.texture = this.backgroundTexture; } else { this.backgroundImage.texture = await PIXI.Texture.fromURL(imageUrl); } - this.backgroundImage.x = this.backgroundImage.width / 2; - this.backgroundImage.y = this.backgroundImage.height / 2; + this.backgroundImage.angle = imageAngle; - this.backgroundImage.width = imageWidth; - this.backgroundImage.height = imageHeight; + if (imageWidth !== undefined + && imageWidth !== null + && imageWidth !== 0 + && imageHeight !== undefined + && imageHeight !== null + && imageHeight !== 0) { + console.log(imageWidth, imageHeight); + this.backgroundImage.width = imageWidth; + this.backgroundImage.height = imageHeight; + } else { + this.backgroundImage.width = this.backgroundImage.texture.width; + this.backgroundImage.height = this.backgroundImage.texture.height; + } + + this.backgroundImage.x = this.backgroundImage.width / 2; + this.backgroundImage.y = this.backgroundImage.height / 2; this.resetCamera2D(); } From 5a515fd50ce576273eec07b849f9448389accc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sun, 7 Feb 2021 10:34:29 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/working-area/working-area.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 207aa14..bee4eed 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -157,8 +157,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * Beta版: 该版本相对于α版已有了很大的改进,消除了严重的错误,但还是存在着一些缺陷,需要经过多次测试来进一步消除,此版本主要的修改对像是软件的UI。 * RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。 * Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。 + * 修改-修订版本号增加 + * 新增-子版本号增加 + * 重大调整-主版本号增加 + * 日期变更-日期版本号增加 */ - public VERSION = '1.0.20.20210207_beta'; + public VERSION = '1.2.1.20210207_beta'; /** * 数据初始化 */ From e5017fbc3d7a605baf2fbd97dbff7a035870acc1 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Mon, 8 Feb 2021 10:24:15 +0800 Subject: [PATCH 5/9] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=BA=95=E5=9B=BE10MB=E9=99=90=E5=88=B6,=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BA=95=E5=9B=BE=E5=AE=BD=E9=AB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/collection-tools/addPlaneFigure.html | 2 +- .../collection-tools.component.ts | 74 ++++++++++++------- .../ui/collection-tools/editPlaneFigure.html | 13 +++- .../collection-tools/leftFunctionalDomain.ts | 49 +++++++++++- src/app/ui/collection-tools/panel.scss | 11 ++- 5 files changed, 116 insertions(+), 33 deletions(-) diff --git a/src/app/ui/collection-tools/addPlaneFigure.html b/src/app/ui/collection-tools/addPlaneFigure.html index 930bf81..75e4722 100644 --- a/src/app/ui/collection-tools/addPlaneFigure.html +++ b/src/app/ui/collection-tools/addPlaneFigure.html @@ -18,7 +18,7 @@
- +
diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index a88ea02..52ec061 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -1434,12 +1434,23 @@ export class CollectionToolsComponent implements OnInit { Panel: this.beforeOneCheckedBuilding, buildingData: e, } - let dialogRef = this.dialog.open(editPlaneFigureComponent,{data}); + let dialogRef = this.dialog.open(editPlaneFigureComponent,{disableClose: true,hasBackdrop: false,position: {left:'150px',top:'200px'},data}); + dialogRef.keydownEvents().subscribe(data=>{ + if (data.key === 'Enter') { + this.canvas.refreshBackgroundImage() + } + }) dialogRef.afterClosed().subscribe(data=>{ if (data =='总平面图') { - this.renovateSitePlan() + let isSuccess = this.renovateSitePlan() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) } else if (data =='建筑') { - this.renovateBuilding() + let isSuccess = this.renovateBuilding() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) } }) } @@ -1632,46 +1643,57 @@ export class CollectionToolsComponent implements OnInit { let file = e.target.files[0] || null //获取上传的文件 let fileSize = file.size || null //上传文件的总大小 let maxSize = 5 * 1024 * 1024 //5MB一个分片 + let tenSize = 10 * 1024 * 1024 //10MB限制 if (file && fileSize<=maxSize) { //上传文件<=5MB时 let formData = new FormData() formData.append("file",file) this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ - this.renovateBaseMap(data.objectName,item) + this.renovateBaseMap('/api/Objects/WebPlan2D/' + data.objectName,item) }) + } else if (file && fileSize>maxSize && fileSize10MB时 + let upload = this.canvasData.sectionUpload(sessionStorage.getItem('companyId'),file) + upload.then(res=>{ this.renovateBaseMap('/api/Objects/PlanPlatform/' + res,item) }) } else { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 - this.snackBar.open('上传底图需小于5MB','确定',config); + this.snackBar.open('上传底图需小于10MB','确定',config); } } //封装 替换底图 function renovateBaseMap (e,item) { - item.imageUrl = '/api/Objects/WebPlan2D/' + e - if (this.checkedBuildingIndex ==-1) { //总平面图 - this.http.put(`/api/CompanyAccount/SitePlans/${item.id}`,item).subscribe(data=>{ - let isSuccess = this.renovateSitePlan() - isSuccess.then(res=>{ - this.canvas.refreshBackgroundImage() + let that = this + let img = new Image() + img.src = e + img.onload = function () { + item.imageUrl = e + item.imageWidth = img.width + item.imageHeight = img.height + if (that.checkedBuildingIndex ==-1) { //总平面图 + that.http.put(`/api/CompanyAccount/SitePlans/${item.id}`,item).subscribe(data=>{ + let isSuccess = that.renovateSitePlan() + isSuccess.then(res=>{ + that.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + that.snackBar.open('上传底图成功','确定',config); }) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('上传底图成功','确定',config); - }) - } else { //楼层/区域 - this.http.put(`/api/CompanyAccount/BuildingAreas/${item.id}`,item).subscribe(data=>{ - let isSuccess = this.renovateBuilding() - isSuccess.then(res=>{ - this.canvas.refreshBackgroundImage() + } else { //楼层/区域 + that.http.put(`/api/CompanyAccount/BuildingAreas/${item.id}`,item).subscribe(data=>{ + let isSuccess = that.renovateBuilding() + isSuccess.then(res=>{ + that.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + that.snackBar.open('上传底图成功','确定',config); }) - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('上传底图成功','确定',config); - }) + } } } diff --git a/src/app/ui/collection-tools/editPlaneFigure.html b/src/app/ui/collection-tools/editPlaneFigure.html index a0f8016..bab09da 100644 --- a/src/app/ui/collection-tools/editPlaneFigure.html +++ b/src/app/ui/collection-tools/editPlaneFigure.html @@ -19,7 +19,7 @@
- +
@@ -27,6 +27,17 @@ +
+ + + + + + + +

按Enter键可浏览图片效果

+
+
- +
diff --git a/src/app/ui/collection-tools/leftFunctionalDomain.ts b/src/app/ui/collection-tools/leftFunctionalDomain.ts index 92be8fb..079f199 100644 --- a/src/app/ui/collection-tools/leftFunctionalDomain.ts +++ b/src/app/ui/collection-tools/leftFunctionalDomain.ts @@ -73,6 +73,8 @@ export class editPlaneFigureComponent implements OnInit { this.details = this.data.buildingData.details || '' this.imgWidth = this.data.buildingData.imageWidth || 0 this.imgHeight = this.data.buildingData.imageHeight || 0 + this.oldWidth = JSON.parse(JSON.stringify(this.data.buildingData.imageWidth || 0)) + this.oldHeight = JSON.parse(JSON.stringify(this.data.buildingData.imageHeight || 0)) if (this.imgWidth==0 && this.imgHeight==0 && this.data.buildingData.imageUrl) { let that = this let img = new Image() @@ -93,6 +95,9 @@ export class editPlaneFigureComponent implements OnInit { }); } + oldWidth:number; //原图片宽 + oldHeight:number; //原图片高 + name:any; //name checked:boolean = false;//是否为避难层 area:number; //面积 @@ -126,6 +131,17 @@ export class editPlaneFigureComponent implements OnInit { e.checked? this.imgScale = Number((this.imgWidth/this.imgHeight)) : null } + //关闭 + close () { + if (this.oldWidth === this.imgWidth && this.oldHeight === this.imgHeight) { + this.dialogRef.close() + } else { + this.canvasData.selectStorey.imageWidth = this.oldWidth + this.canvasData.selectStorey.imageHeight = this.oldHeight + this.dialogRef.close('更新背景图'); + } + } + //提交表单修改平面图 onSubmit (e) { if (!this.data.isBuilding) { //总平面图 修改平面图 From f90a4a84159ea6a04b1dc5ed59e18eadfc3db7e5 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Mon, 8 Feb 2021 12:43:16 +0800 Subject: [PATCH 8/9] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E4=BF=AE=E6=AD=A3bu?= =?UTF-8?q?tton=E6=8C=89=E9=92=AEBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/ui/collection-tools/editPlaneFigure.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/ui/collection-tools/editPlaneFigure.html b/src/app/ui/collection-tools/editPlaneFigure.html index d21cbf3..e847c2a 100644 --- a/src/app/ui/collection-tools/editPlaneFigure.html +++ b/src/app/ui/collection-tools/editPlaneFigure.html @@ -42,7 +42,7 @@ - + From 54ecece34bfdb4c37cc834bc9ba0a7b3ddcda070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Sat, 20 Feb 2021 09:28:09 +0800 Subject: [PATCH 9/9] 1.2.2 --- .../working-area/working-area.component.ts | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index bee4eed..fae03ae 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -162,7 +162,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 重大调整-主版本号增加 * 日期变更-日期版本号增加 */ - public VERSION = '1.2.1.20210207_beta'; + public VERSION = '1.2.2.20210220_beta'; /** * 数据初始化 */ @@ -992,24 +992,41 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (imageUrl === undefined || imageUrl === null || imageUrl === '') { this.backgroundImage.texture = this.backgroundTexture; } else { - this.backgroundImage.texture = await PIXI.Texture.fromURL(imageUrl); + // this.backgroundImage.texture = await PIXI.Texture.fromURL(imageUrl); + if (imageWidth !== undefined + && imageWidth !== null + && imageWidth !== 0 + && imageHeight !== undefined + && imageHeight !== null + && imageHeight !== 0) { + // console.log(imageWidth, imageHeight); + // this.backgroundImage.width = imageWidth; + // this.backgroundImage.height = imageHeight; + this.backgroundImage.texture = + await PIXI.Texture.fromURL(imageUrl + '?x-oss-process=image/resize,m_fixed,h_' + imageHeight + ',w_' + imageWidth); // 图片处理 + } else { + // this.backgroundImage.width = this.backgroundImage.texture.width; + // this.backgroundImage.height = this.backgroundImage.texture.height; + this.backgroundImage.texture = + await PIXI.Texture.fromURL(imageUrl); // 请求原图 + } } this.backgroundImage.angle = imageAngle; - if (imageWidth !== undefined - && imageWidth !== null - && imageWidth !== 0 - && imageHeight !== undefined - && imageHeight !== null - && imageHeight !== 0) { - console.log(imageWidth, imageHeight); - this.backgroundImage.width = imageWidth; - this.backgroundImage.height = imageHeight; - } else { - this.backgroundImage.width = this.backgroundImage.texture.width; - this.backgroundImage.height = this.backgroundImage.texture.height; - } + // if (imageWidth !== undefined + // && imageWidth !== null + // && imageWidth !== 0 + // && imageHeight !== undefined + // && imageHeight !== null + // && imageHeight !== 0) { + // console.log(imageWidth, imageHeight); + // this.backgroundImage.width = imageWidth; + // this.backgroundImage.height = imageHeight; + // } else { + // this.backgroundImage.width = this.backgroundImage.texture.width; + // this.backgroundImage.height = this.backgroundImage.texture.height; + // } this.backgroundImage.x = this.backgroundImage.width / 2; this.backgroundImage.y = this.backgroundImage.height / 2;