From 716019036defdc10878afc2c5e3883487c405b85 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Tue, 2 Nov 2021 11:26:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A0=8F=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/facility-window/facility-window.ts | 10 ++--- src/app/pages/plan/plan.component.html | 17 ++++++++- src/app/pages/plan/plan.component.scss | 36 +++++++++++++++++- src/app/pages/plan/plan.component.ts | 37 +++++++++++++++++++ 4 files changed, 92 insertions(+), 8 deletions(-) diff --git a/src/app/babylon/view/facility-window/facility-window.ts b/src/app/babylon/view/facility-window/facility-window.ts index 6ebe296..4d64d30 100644 --- a/src/app/babylon/view/facility-window/facility-window.ts +++ b/src/app/babylon/view/facility-window/facility-window.ts @@ -11,6 +11,7 @@ import { Image, Rectangle, } from '@babylonjs/gui'; +import { PlanComponent } from 'src/app/pages/plan/plan.component'; import { ConfigManager } from '../../controller/config-manager'; import { DataManager, ModelChangeType } from '../../controller/data-manager'; import { Event_ChangeFacility } from '../../controller/event-manager/events/event-change-facility'; @@ -29,7 +30,6 @@ import { ModelInfo_facility } from '../../model/info/model/model-info-facility'; import { BabylonTool } from '../../tool/babylon-tool'; import { BabylonUIStyleTool } from '../../tool/babylon-ui-style-tool'; import { GizmoTool } from '../../tool/gizmo-tool'; - import { CopyFacilityInfo, FacilityInfoInSceneWindow } from '../facilityinfoinscene-window/facilityinfoinscene-window'; import { ToolbarWindow } from '../toolbar-window/toobar-window'; import { UIBase } from '../window-base/ui-base'; @@ -39,7 +39,7 @@ import { FacilityUIItem } from './facility-ui-item'; export class FacilityWindow extends UIBase { - // three: ThreeDimensionalHomeComponent;//前端组件 + three: PlanComponent;//前端组件 allFacilityUIItemes: FacilityUIItem[] = []; @@ -172,10 +172,10 @@ export class FacilityWindow extends UIBase { console.log("所有可用的设备", instance.allFacilityUIItemes); - // ThreeDimensionalHomeComponent.instance.getAllIcons(instance) + PlanComponent.instance.getAllIcons(instance) }) - // instance.three = ThreeDimensionalHomeComponent.instance + instance.three = PlanComponent.instance } @@ -245,7 +245,7 @@ export class FacilityWindow extends UIBase { } } else { //右键取消 - // instance.three.unSelectBottomIcon(); + instance.three.unSelectBottomIcon(); } break; diff --git a/src/app/pages/plan/plan.component.html b/src/app/pages/plan/plan.component.html index 39368d4..2293c8a 100644 --- a/src/app/pages/plan/plan.component.html +++ b/src/app/pages/plan/plan.component.html @@ -1,7 +1,7 @@
- +
@@ -19,7 +19,20 @@
- + + + +
+
+
+
+ +

{{item.getIconName()}}

+
+
+
+
+
diff --git a/src/app/pages/plan/plan.component.scss b/src/app/pages/plan/plan.component.scss index 10b263a..746bd9a 100644 --- a/src/app/pages/plan/plan.component.scss +++ b/src/app/pages/plan/plan.component.scss @@ -5,7 +5,7 @@ position: relative; canvas{ width: 100%; height: 100%; border: none; outline: none; } } -.anticon { font-size: 16px; cursor: pointer; } //字体图标 +.anticon{ font-size: 16px; cursor: pointer; } //字体图标 //文本溢出 .overflowText{ overflow: hidden; @@ -75,6 +75,40 @@ transition: margin-left 0.5s; } +//底部图标栏 +.bottomIcons{ + width: 80%; + height: 60px; + line-height: 60px; + position: absolute; + left: 0; + right: 0; + bottom: 1px; + margin: auto;/*这行代码是关键*/ + color: #fff; + background: rgba(0,17,33,0.7); + border-radius: 10px 10px 0px 0px; + display: flex; + box-sizing: border-box; + padding: 1px; + .autoScroll{ width: 30px; text-align: center; } + .bottomCenter{ + flex: 1; + overflow: hidden; + .everyIcon { + width: 100px; + height: 58px; + line-height: normal; + text-align: center; + display: inline-block; + overflow: hidden; + img { width: 40px; height: 40px; margin-top: 3px; cursor: pointer; } + p { height: 18px; line-height: 18px; margin-top: -5px; font-size: 12px; } + } + } + .selectLeftIcon { background: rgb(0,128,255,0.5); } //选中样式 +} + //右上角快捷栏 .rightTopFast{ width: 60px; diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 5fabf25..2ebc800 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -12,6 +12,8 @@ import { BuildingStatus } from 'src/app/babylon/controller/status/building-statu import { BuildingUIItem } from 'src/app/babylon/view/building-window/building-ui-item'; import { BuildingType } from 'src/app/babylon/model/data/institution/building/building-data'; import { BuildingWindow } from 'src/app/babylon/view/building-window/building-window'; +import { FacilityUIItem } from 'src/app/babylon/view/facility-window/facility-ui-item'; +import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window'; @@ -136,6 +138,41 @@ export class PlanComponent implements OnInit { } } + allFacilityUIItemes: FacilityUIItem[] = []; //底部所有 图标 + beforeOneIcon: string = null; //当前选择 图标 + + // 获取 底部图标栏list + getAllIcons(e: FacilityWindow) { + this.allFacilityUIItemes = e.allFacilityUIItemes + this.beforeOneIcon = null + } + + //选择底部图标 + selectBottomIcon(e: FacilityUIItem) { + if (this.beforeOneIcon != e.getIconID()) { + this.beforeOneIcon = e.getIconID() + e.select() + } else { + this.beforeOneIcon = null + e.unSelect() + } + } + + //取消选择 底部图标 + unSelectBottomIcon() { + if (this.beforeOneIcon) { + let e: FacilityUIItem = this.allFacilityUIItemes.find(item => { return item.getIconID() === this.beforeOneIcon }) + e ? e.unSelect() : null + this.beforeOneIcon = null + } + } + + //底部图标栏 滚动条 + bottomScroll(e) { + let bootomDiv = this.element.nativeElement.querySelector('#bottomCenter') + e == 0 ? bootomDiv.scrollLeft = bootomDiv.scrollLeft + 50 : bootomDiv.scrollLeft = bootomDiv.scrollLeft - 50 + } + //保存 preserve() { ToolbarWindow.instance.onBtnSave(); From d99541b5f08dd98c8ce9f08d1d64fd50175d19c2 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Tue, 2 Nov 2021 14:07:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=A0=8F=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/toolbar-window/toobar-window.ts | 7 ++- src/app/pages/plan/plan.component.html | 12 ++++- src/app/pages/plan/plan.component.scss | 19 ++++++-- src/app/pages/plan/plan.component.ts | 44 ++++++++++++++++++ src/assets/images/adsorb.png | Bin 0 -> 1731 bytes src/assets/images/revolveThree.png | Bin 0 -> 495 bytes src/assets/images/scaleThree.png | Bin 0 -> 243 bytes src/assets/images/translationThree.png | Bin 0 -> 242 bytes src/assets/images/verticalView.png | Bin 0 -> 1844 bytes 9 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 src/assets/images/adsorb.png create mode 100644 src/assets/images/revolveThree.png create mode 100644 src/assets/images/scaleThree.png create mode 100644 src/assets/images/translationThree.png create mode 100644 src/assets/images/verticalView.png diff --git a/src/app/babylon/view/toolbar-window/toobar-window.ts b/src/app/babylon/view/toolbar-window/toobar-window.ts index c65df62..cfbe8f9 100644 --- a/src/app/babylon/view/toolbar-window/toobar-window.ts +++ b/src/app/babylon/view/toolbar-window/toobar-window.ts @@ -3,6 +3,7 @@ import { PointerEventTypes } from "@babylonjs/core/Events/pointerEvents"; import { PointerInfo } from "@babylonjs/core/Events/pointerEvents"; import { EventState } from "@babylonjs/core/Misc/observable"; import { Button, Control, Rectangle } from "@babylonjs/gui"; +import { PlanComponent } from "src/app/pages/plan/plan.component"; import { DataManager } from "../../controller/data-manager"; import { ModeManager } from "../../controller/mode-manager"; import { SceneManager } from "../../controller/scene-manager"; @@ -12,10 +13,8 @@ import { BabylonUIStyleTool } from "../../tool/babylon-ui-style-tool"; import { GizmoTool, TransformUIType } from "../../tool/gizmo-tool"; import { MeasureTool, MeasureType } from "../../tool/measure-tool"; import { BuildingWindow } from "../building-window/building-window"; - import { FacilityWindow } from "../facility-window/facility-window"; import { CopyFacilityInfo, FacilityInfoInSceneWindow } from "../facilityinfoinscene-window/facilityinfoinscene-window"; - import { UIBase } from "../window-base/ui-base"; /** @@ -33,7 +32,7 @@ export class ToolbarWindow extends UIBase { //#region 前端对接 - // three: ThreeDimensionalHomeComponent;//前端组件 + three: PlanComponent;//前端组件 compassAlpha: number;//指南针旋转 0-2π /** @@ -220,7 +219,7 @@ export class ToolbarWindow extends UIBase { //改变拾取状态 changeMeshAdsorbY() { this.isMeshAdsorb = !this.isMeshAdsorb; - // this.three.updateSelectAdsorb(); + PlanComponent.instance.updateSelectAdsorb(); } //#endregion diff --git a/src/app/pages/plan/plan.component.html b/src/app/pages/plan/plan.component.html index 2293c8a..f33d257 100644 --- a/src/app/pages/plan/plan.component.html +++ b/src/app/pages/plan/plan.component.html @@ -12,8 +12,9 @@
-
@@ -36,6 +37,13 @@
+
+ + + + + +
diff --git a/src/app/pages/plan/plan.component.scss b/src/app/pages/plan/plan.component.scss index 746bd9a..7d9a655 100644 --- a/src/app/pages/plan/plan.component.scss +++ b/src/app/pages/plan/plan.component.scss @@ -65,7 +65,6 @@ border-bottom: 1px solid rgba(255, 255, 255, 0.1); .modelTitle { font-size: 14px; } label { display: block; } - .anticon { margin: 0 3px; } //字体图标 } .selectLeftBuilding { background-color: #2196f3; } //选中样式 } @@ -103,7 +102,7 @@ display: inline-block; overflow: hidden; img { width: 40px; height: 40px; margin-top: 3px; cursor: pointer; } - p { height: 18px; line-height: 18px; margin-top: -5px; font-size: 12px; } + p { height: 18px; line-height: 18px; margin-top: -3px; font-size: 12px; } } } .selectLeftIcon { background: rgb(0,128,255,0.5); } //选中样式 @@ -111,7 +110,7 @@ //右上角快捷栏 .rightTopFast{ - width: 60px; + width: 250px; height: 38px; position: absolute; right: 1px; @@ -129,4 +128,18 @@ color: #fff; cursor: pointer; } + .publicFast { + box-sizing: border-box; + padding: 1px 5px; + background-color: rgba(0,0,0,0.5); + } + .leftFast { + :first-child{ background: url(../../../assets/images/translationThree.png) no-repeat center; } + :nth-child(2){ background: url(../../../assets/images/revolveThree.png) no-repeat center; } + :nth-child(3){ background: url(../../../assets/images/scaleThree.png) no-repeat center; } + :nth-child(4){ background: url(../../../assets/images/adsorb.png) no-repeat center; } + :nth-child(5){ background: url(../../../assets/images/verticalView.png) no-repeat center; } + .leftFastIsTure { border: 1px solid #fff; } //吸附样式 + } + .selectRightTopFast { border: 1px solid #fff; } //选种样式 } \ No newline at end of file diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 2ebc800..a6cd080 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -126,6 +126,12 @@ export class PlanComponent implements OnInit { this.editBuildingPop = e; //打开弹窗 } + //聚焦 建筑 + positionModelBuilding(event, e: BuildingUIItem) { + event.stopPropagation() + e.lookAt() + } + //删除建筑 deleteModelBuilding(event, e: BuildingUIItem) { event.stopPropagation() @@ -173,6 +179,44 @@ export class PlanComponent implements OnInit { e == 0 ? bootomDiv.scrollLeft = bootomDiv.scrollLeft + 50 : bootomDiv.scrollLeft = bootomDiv.scrollLeft - 50 } + selectRightTopFast: number = 0; //当前选择功能 快捷栏 + selectAdsorb: boolean = false; //吸附状态 + topLevelView: boolean = false; //顶视图状态 + + //平移 + translation() { + this.selectRightTopFast = 0 + ToolbarWindow.instance.changeGizmoType_position(); + } + + //旋转 + revolve() { + this.selectRightTopFast = 1 + ToolbarWindow.instance.changeGizmoType_Rotation(); + } + + //缩放 + scale() { + this.selectRightTopFast = 2 + ToolbarWindow.instance.changeGizmoType_Scale(); + } + + //吸附 + adsorb() { + ToolbarWindow.instance.changeMeshAdsorbY(); + } + + //获取吸附的状态 + updateSelectAdsorb() { + this.selectAdsorb = ToolbarWindow.instance.isMeshAdsorb; + } + + //切换至顶视图 + toggleTopLevelView() { + this.topLevelView = !this.topLevelView + ToolbarWindow.instance.changeTopView(this.topLevelView) + } + //保存 preserve() { ToolbarWindow.instance.onBtnSave(); diff --git a/src/assets/images/adsorb.png b/src/assets/images/adsorb.png new file mode 100644 index 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%y6MPct$72h7J~K7 vbpB}8zSg3awHrRS%w3+he)z`0l9zYnA07O7Y;xvn^Ec!3Hh4}{xAy)G{}M>h literal 0 HcmV?d00001 diff --git a/src/assets/images/revolveThree.png b/src/assets/images/revolveThree.png new file mode 100644 index 0000000000000000000000000000000000000000..53c5acec1301b3ba543db386e27746362b2a0542 GIT binary patch literal 495 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tD*}8%T!Hlep#YSx+vWn@YF-lL z7tFxI!6P6dE+H)=ub`}=VPo&$;S(Glk)B;#UR~eZ-rYZW_WZ@m*Kgjw`|$D8m#^Qx z|M>aq_uqg24BCAiXvBU`7sn6@N!EkCP6q=d7%mvEQ{nup8N1Bn(zIi%-v7P7rnuqt zojHC>yczax(th54W=pi#feq^>W!^qqasA7}@bw=*a^&!_p5kI_NZOusNtMCi&7_#7 zDXZrk_~vTde#OmY_Jh3lHZ3xOf|7ZCOd*1T8(Saw^A@?dq+C1tM0&!l4huCt|LyDz zQ|=cZ^4(tl%ZyDM0iyi83Pu;97zS%eY8)MJ) h`MGmmU*-72Jm;VAcK2N~GJsxT@O1TaS?83{1OQRPFdP5? literal 0 HcmV?d00001 diff --git a/src/assets/images/scaleThree.png b/src/assets/images/scaleThree.png new file mode 100644 index 0000000000000000000000000000000000000000..cca8a3ef2b6d87cdef72d5c3b5a6164bb6dc0313 GIT binary patch literal 243 zcmeAS@N?(olHy`uVBq!ia0vp^!XV7S3?yCqj{O5tW&u7Su0Z-f>EL7Xu|Ghaf+azI z!3;dYA`&tR8rC)r`)}WW{`P%n>Ae7;WVEM?V~E7%r58>MH7Ia61Zv4Io%G?qz4jWR zoMo=%2OsfR^*OvzPMDC@sQxcKR4Lu{_O;E+PB!)3jo9HoQ+L*0Z^6lX{V&dbl+<+h q#zldR#b(upo|eG7orFnGH9xvXQaG}Wq?nJE0F$A7T~fn%?FuS666=m zz~UVeo?Kkt+&+8$;^nJ%-+rF|>f!~UY?!BuV~E7%wG$5VH7M{nb89VNP5k}8|LdZY zMmCbwS#h_PNEc+Q&k4JFc46?6-xA9ov5U-h)n$roRk39A3^G|<71DSmccVH3hghrp jvVC**o;mMmDOb+8Seg0L{rI~e8yGxY{an^LB{Ts5UD|c8 literal 0 HcmV?d00001 diff --git a/src/assets/images/verticalView.png b/src/assets/images/verticalView.png new file mode 100644 index 0000000000000000000000000000000000000000..9efe806c527cba8c13493195aff2b132e6391869 GIT binary patch literal 1844 zcmbVN32YQq7+$EHwLp}kmR84Uv0Srr?6SwC+oro)=qOv;ve{WJ9Ot@X4>7B z5EMvYk%C!Dzy@QiQKaRFQk4K=l#1G7KqV0Z5<#VD456S6#3T4-yWN06iA?h5y?O6@ z-+%uTD=%A+F+OX&$z;l4O1+hEo@|V+_{#+*21(Oo`C+l16Ao(joUmYyKt$;FUm=8&nRIG(t6V4QmwIqXJf!Rlh8U zhXYkUtTIATW&)X6B}lv+(PrIo0eD#*xKJ215+j@#W%m;f+G3+g>m0Zsh#{y?=7nI> zJ)usTble4nDZ{fmdtWfm(Lq@iS!l2zvULDgq&gHyxsmqBVOfQOp>~!#_Zg3;T$O`D z7#?Vq3)~1(;<1rVn+>DPWI|n^k7guIXC)3WUKa|TV-^ISW*rVYPg(<*#S*Y$LDp)) zoCLvPR?^|LP}Tt8?1AC?UYTn!QegN#|3B|Ps|v6L+3*AN7=>x%4qYl}Fse<-(pdyn zCRbqrNu&$Saz+`rP|k=y;L+r^@W37zqK$+AB>j)P7=meXP>--GD6WIvx^Ld$P=;jm*E%T%j^AE{;sB-r6p*vi~w_DPdzL^tCt_B&ekojFy1YGwAA zfzNkf-SIcNo+~xak=(QLH>EjeSEz4gA3AiaqI1f$F&k!SJGT|R*m_27-*vV%r?q9T zwWqD?YX3mfn!ft;k!8IHYgS(@syWd2$6)j7ngdl>>~?JNGZ*CU#YaDxBn8g5Pi3aY zKghGkkCstw{Om8U<#Ei#8U4&R@4h06WnaAJc=_AvtrHfqV(d!(QesPObYtP>lY`2t zcrQ~p1%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