瀏覽代碼

Add setter for IsDrag

habeebweeb 4 年之前
父節點
當前提交
fb1852bf76
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/CustomGizmo.cs

+ 6 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/CustomGizmo.cs

@@ -11,7 +11,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private FieldInfo beSelectedType = Utility.GetFieldInfo<GizmoRender>("beSelectedType");
         private int SelectedType => (int)beSelectedType.GetValue(this);
         private static FieldInfo is_drag_ = Utility.GetFieldInfo<GizmoRender>("is_drag_");
-        private static bool IsDrag => (bool)is_drag_.GetValue(null);
+        public static bool IsDrag
+        {
+            get => (bool)is_drag_.GetValue(null);
+            private set => is_drag_.SetValue(null, value);
+        }
         private Vector3 positionOld = Vector3.zero;
         private Vector3 deltaPosition = Vector3.zero;
         private Vector3 localPositionOld = Vector3.zero;
@@ -39,7 +43,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => base.Visible;
             set
             {
-                if (value && IsDrag) is_drag_.SetValue(null, false);
+                if (value && IsDrag) IsDrag = false;
                 base.Visible = value;
             }
         }