陈鹏飞 4 years ago
parent
commit
ebd8927e90
  1. 18
      package-lock.json
  2. 2
      package.json
  3. 60
      src/app/working-area/working-area.component.ts

18
package-lock.json generated

@ -12898,6 +12898,11 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"penner": {
"version": "0.1.3",
"resolved": "https://registry.npm.taobao.org/penner/download/penner-0.1.3.tgz",
"integrity": "sha1-C4tILU6bOa8vPXw3WSIpuKzClwU="
},
"perfect-scrollbar": { "perfect-scrollbar": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npm.taobao.org/perfect-scrollbar/download/perfect-scrollbar-1.5.0.tgz", "resolved": "https://registry.npm.taobao.org/perfect-scrollbar/download/perfect-scrollbar-1.5.0.tgz",
@ -12975,6 +12980,14 @@
"@pixi/filter-zoom-blur": "3.1.1" "@pixi/filter-zoom-blur": "3.1.1"
} }
}, },
"pixi-viewport": {
"version": "4.20.0",
"resolved": "https://registry.npm.taobao.org/pixi-viewport/download/pixi-viewport-4.20.0.tgz",
"integrity": "sha1-Gu3vsQhZqv7toJUJ8o4jNvaVDQ4=",
"requires": {
"penner": "^0.1.3"
}
},
"pixi.js": { "pixi.js": {
"version": "5.3.3", "version": "5.3.3",
"resolved": "https://registry.npm.taobao.org/pixi.js/download/pixi.js-5.3.3.tgz", "resolved": "https://registry.npm.taobao.org/pixi.js/download/pixi.js-5.3.3.tgz",
@ -15913,6 +15926,11 @@
} }
} }
}, },
"three": {
"version": "0.125.2",
"resolved": "https://registry.npm.taobao.org/three/download/three-0.125.2.tgz",
"integrity": "sha1-3LoSdJoutBUi4VISuRnNP79ymxI="
},
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "https://registry.npm.taobao.org/through/download/through-2.3.8.tgz", "resolved": "https://registry.npm.taobao.org/through/download/through-2.3.8.tgz",

2
package.json

@ -35,9 +35,11 @@
"ngx-echarts": "^4.2.2", "ngx-echarts": "^4.2.2",
"ngx-perfect-scrollbar": "^8.0.0", "ngx-perfect-scrollbar": "^8.0.0",
"pixi-filters": "^3.1.1", "pixi-filters": "^3.1.1",
"pixi-viewport": "^4.20.0",
"pixi.js": "^5.3.2", "pixi.js": "^5.3.2",
"rxjs": "~6.5.4", "rxjs": "~6.5.4",
"swiper": "^5.3.7", "swiper": "^5.3.7",
"three": "^0.125.2",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"viewerjs": "^1.9.0", "viewerjs": "^1.9.0",
"zone.js": "~0.10.2" "zone.js": "~0.10.2"

60
src/app/working-area/working-area.component.ts

@ -157,8 +157,12 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* Beta版: 该版本相对于α版已有了很大的改进UI * Beta版: 该版本相对于α版已有了很大的改进UI
* RC版: 该版本已经相当成熟了BUG * RC版: 该版本已经相当成熟了BUG
* Release版: 该版本意味使Release不会以单词形式出现在软件封面上® * Release版: 该版本意味使Release不会以单词形式出现在软件封面上®
* -
* -
* -
* -
*/ */
public VERSION = '1.0.18.20210205_beta'; public VERSION = '1.2.2.20210220_beta';
/** /**
* *
*/ */
@ -468,8 +472,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* *
*/ */
public zoomFit() { public zoomFit() {
const imageWidth = this.backgroundImage.texture.width; const imageWidth = this.backgroundImage.width;
const imageHeight = this.backgroundImage.texture.height; const imageHeight = this.backgroundImage.height;
const appWidth = this.app.view.width - 470; const appWidth = this.app.view.width - 470;
const appHeight = this.app.view.height; const appHeight = this.app.view.height;
const wScale = appWidth / imageWidth; const wScale = appWidth / imageWidth;
@ -974,26 +978,60 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
/** /**
* *
*/ */
public async refreshBackgroundImage(imageUrl: string = this.canvasData.selectStorey.imageUrl, imageAngle: number = this.canvasData.selectStorey.imageAngle): Promise<void> { 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<void> {
if (imageAngle === undefined || imageAngle === null) { if (imageAngle === undefined || imageAngle === null) {
imageAngle = 0; imageAngle = 0;
} }
this.backgroundImage.scale.set(1); this.backgroundImage.scale.set(1);
// this.backgroundImage.pivot.set(0);
if (imageUrl === undefined || imageUrl === null || imageUrl === '') { if (imageUrl === undefined || imageUrl === null || imageUrl === '') {
this.backgroundImage.texture = this.backgroundTexture; this.backgroundImage.texture = this.backgroundTexture;
} else { } 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;
// }
this.backgroundImage.x = this.backgroundImage.width / 2; this.backgroundImage.x = this.backgroundImage.width / 2;
this.backgroundImage.y = this.backgroundImage.height / 2; this.backgroundImage.y = this.backgroundImage.height / 2;
this.backgroundImage.angle = imageAngle;
this.resetCamera2D(); this.resetCamera2D();
// this.backgroundImage.children.forEach((item) => {
// if (item instanceof AxShape) {
// item.refresh();
// }
// });
} }
/** /**
* *

Loading…
Cancel
Save