mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-16 22:16:55 +07:00
add snapping check box
This commit is contained in:
@@ -16,7 +16,8 @@ namespace IsoTools.Internal {
|
||||
public static readonly float SnappingDistance = 0.2f;
|
||||
|
||||
static bool IsSnappingEnabled() {
|
||||
return !Event.current.control;
|
||||
var iso_world = IsoWorld.Instance;
|
||||
return iso_world && (iso_world.isSnappingEnabled != Event.current.control);
|
||||
}
|
||||
|
||||
void GrabPositions() {
|
||||
@@ -64,6 +65,7 @@ namespace IsoTools.Internal {
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_showIsoBounds"));
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_showScreenBounds"));
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_showDepends"));
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_snappingEnabled"));
|
||||
if ( GUI.changed ) {
|
||||
so.ApplyModifiedProperties();
|
||||
}
|
||||
@@ -281,6 +283,8 @@ namespace IsoTools.Internal {
|
||||
}
|
||||
|
||||
void XYMoveRectangle() {
|
||||
var iso_world = IsoWorld.Instance;
|
||||
if ( iso_world ) {
|
||||
Handles.color = new Color(
|
||||
Handles.zAxisColor.r,
|
||||
Handles.zAxisColor.g,
|
||||
@@ -312,6 +316,7 @@ namespace IsoTools.Internal {
|
||||
_otherObjects);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
@@ -38,6 +38,20 @@ namespace IsoTools.Internal {
|
||||
.ToList();
|
||||
}
|
||||
|
||||
void DrawWorldEditorProperties() {
|
||||
var iso_world = IsoWorld.Instance;
|
||||
if ( iso_world ) {
|
||||
var so = new SerializedObject(iso_world);
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_showIsoBounds"));
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_showScreenBounds"));
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_showDepends"));
|
||||
EditorGUILayout.PropertyField(so.FindProperty("_snappingEnabled"));
|
||||
if ( GUI.changed ) {
|
||||
so.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XYMoveSlider(Color color, Vector3 dir) {
|
||||
var iso_world = IsoWorld.Instance;
|
||||
if ( iso_world ) {
|
||||
@@ -64,6 +78,8 @@ namespace IsoTools.Internal {
|
||||
}
|
||||
|
||||
void XYMoveRectangle() {
|
||||
var iso_world = IsoWorld.Instance;
|
||||
if ( iso_world ) {
|
||||
Handles.color = new Color(
|
||||
Handles.zAxisColor.r,
|
||||
Handles.zAxisColor.g,
|
||||
@@ -105,6 +121,7 @@ namespace IsoTools.Internal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
@@ -135,6 +152,7 @@ namespace IsoTools.Internal {
|
||||
public override void OnInspectorGUI() {
|
||||
DrawDefaultInspector();
|
||||
GrabPositions();
|
||||
DrawWorldEditorProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -333,6 +333,11 @@ namespace IsoTools {
|
||||
get { return _showDepends; }
|
||||
set { _showDepends = value; }
|
||||
}
|
||||
[SerializeField] bool _snappingEnabled = true;
|
||||
public bool isSnappingEnabled {
|
||||
get { return _snappingEnabled; }
|
||||
set { _snappingEnabled = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user