|
@@ -0,0 +1,74 @@
|
|
|
+/*
|
|
|
+ * ********************************************************************************************************************
|
|
|
+ *
|
|
|
+ * :*$@@%$*: ;: ;; ;;
|
|
|
+ * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@
|
|
|
+ * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$
|
|
|
+ * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$=
|
|
|
+ * =@* %! @ $= % %@= =%@! %=
|
|
|
+ * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =%
|
|
|
+ * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%*
|
|
|
+ * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$
|
|
|
+ * $@* ;@@@%=!: *@*
|
|
|
+ * =@$ ;;;!=%@@@@=! =@!
|
|
|
+ * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司
|
|
|
+ * ;%@@$=$@@%* *@@@$=%@@%;
|
|
|
+ * ::;:: ::;:: All rights reserved.
|
|
|
+ *
|
|
|
+ * ********************************************************************************************************************
|
|
|
+ */
|
|
|
+
|
|
|
+import { SGraphyView } from "@saga-web/graphy/lib";
|
|
|
+import { SMouseButton, SMouseEvent } from "@saga-web/base/lib";
|
|
|
+import { SPoint } from "@saga-web/draw/lib";
|
|
|
+
|
|
|
+/**
|
|
|
+ * 楼层场景
|
|
|
+ *
|
|
|
+ * @author 郝建龙
|
|
|
+ */
|
|
|
+export class FloorView extends SGraphyView {
|
|
|
+ /** 鼠标左键键按下时位置 */
|
|
|
+ private _leftKeyPos = new SPoint();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 鼠标按下事件
|
|
|
+ *
|
|
|
+ * @param event 事件参数
|
|
|
+ */
|
|
|
+ protected onMouseDown(event: MouseEvent): void {
|
|
|
+ let se = new SMouseEvent(event);
|
|
|
+ if (se.ctrlKey) {
|
|
|
+ if (se.buttons & SMouseButton.LeftButton) {
|
|
|
+ this._leftKeyPos.x = se.x;
|
|
|
+ this._leftKeyPos.y = se.y;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ super.onMouseDown(event);
|
|
|
+ }
|
|
|
+ } // Function onMouseDown()
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 鼠标移动事件
|
|
|
+ *
|
|
|
+ * @param event 事件参数
|
|
|
+ */
|
|
|
+ protected onMouseMove(event: MouseEvent): void {
|
|
|
+ // 如果可以移动
|
|
|
+ if (this.moveable) {
|
|
|
+ // 按左键移动
|
|
|
+ let se = new SMouseEvent(event);
|
|
|
+ if (se.ctrlKey) {
|
|
|
+ if (se.buttons & SMouseButton.LeftButton) {
|
|
|
+ this.origin.x += se.x - this._leftKeyPos.x;
|
|
|
+ this.origin.y += se.y - this._leftKeyPos.y;
|
|
|
+ this._leftKeyPos.x = se.x;
|
|
|
+ this._leftKeyPos.y = se.y;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ super.onMouseMove(event);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } // Function onMouseMove()
|
|
|
+} // Class FloorScene
|