fix layer 4 not being usable at certain window sizes

This commit is contained in:
minenice55 2022-07-08 17:58:58 -04:00
parent ee142c9bcc
commit 2409a20aab
4 changed files with 22 additions and 22 deletions

View file

@ -8991,7 +8991,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 704039020} m_HandleRect: {fileID: 704039020}
m_Direction: 0 m_Direction: 0
m_Value: 0 m_Value: 0
m_Size: 0.03287128 m_Size: 0.032871284
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
@ -11675,7 +11675,6 @@ MonoBehaviour:
resizing: 0 resizing: 0
moving: 0 moving: 0
wasDuplicated: 0 wasDuplicated: 0
lastMovePos: {x: 0, y: 0}
isCreating: 0 isCreating: 0
eventObjID: eventObjID:
NormalCol: {r: 0.8470589, g: 0.8470589, b: 1, a: 1} NormalCol: {r: 0.8470589, g: 0.8470589, b: 1, a: 1}
@ -11898,8 +11897,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1} m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: -6.74, y: 0} m_AnchoredPosition: {x: -7.74, y: 0}
m_SizeDelta: {x: 545.82, y: 0} m_SizeDelta: {x: 547.82, y: 0}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &830452353 --- !u!114 &830452353
MonoBehaviour: MonoBehaviour:
@ -12681,7 +12680,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 1589389271} m_HandleRect: {fileID: 1589389271}
m_Direction: 2 m_Direction: 2
m_Value: 1 m_Value: 1
m_Size: 0.9992025 m_Size: 0.9999891
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
@ -15252,7 +15251,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -408.97998, y: -17} m_AnchoredPosition: {x: -408.98004, y: -17}
m_SizeDelta: {x: -817.96, y: -46.29} m_SizeDelta: {x: -817.96, y: -46.29}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1121370303 --- !u!1 &1121370303
@ -15786,7 +15785,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 129.89334} m_AnchoredPosition: {x: 0, y: 162.6935}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1154875944 --- !u!114 &1154875944
@ -21054,7 +21053,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1292844878} m_TargetGraphic: {fileID: 1292844878}
m_HandleRect: {fileID: 1292844877} m_HandleRect: {fileID: 1292844877}
m_Direction: 2 m_Direction: 2
m_Value: 0 m_Value: 1
m_Size: 1 m_Size: 1
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
@ -23880,8 +23879,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -84.09494} m_AnchoredPosition: {x: 0, y: -84.99}
m_SizeDelta: {x: 320, y: -113.02} m_SizeDelta: {x: 320, y: -113.92}
m_Pivot: {x: 0, y: 1} m_Pivot: {x: 0, y: 1}
--- !u!1 &1852819572 --- !u!1 &1852819572
GameObject: GameObject:

View file

@ -199,6 +199,7 @@ namespace HeavenStudio.Editor
for (int i = 0; i < selectedEvents.Count; i++) for (int i = 0; i < selectedEvents.Count; i++)
{ {
//TODO: this is in LateUpdate, so this will never run! change this to something that works properly
if (!(selectedEvents[i].isCreating || selectedEvents[i].wasDuplicated)) if (!(selectedEvents[i].isCreating || selectedEvents[i].wasDuplicated))
{ {
result.Add(selectedEvents[i]); result.Add(selectedEvents[i]);

View file

@ -330,11 +330,10 @@ namespace HeavenStudio.Editor.Track
{ {
movingPlayback = true; movingPlayback = true;
} }
else if (Input.GetMouseButtonUp(1)) else if (Input.GetMouseButtonUp(1) || Conductor.instance.isPlaying)
{ {
movingPlayback = false; movingPlayback = false;
} }
if (movingPlayback) if (movingPlayback)
{ {
RectTransformUtility.ScreenPointToLocalPointInRectangle(TimelineContent, Input.mousePosition, Editor.instance.EditorCamera, out lastMousePos); RectTransformUtility.ScreenPointToLocalPointInRectangle(TimelineContent, Input.mousePosition, Editor.instance.EditorCamera, out lastMousePos);
@ -554,7 +553,7 @@ namespace HeavenStudio.Editor.Track
else else
{ {
entity.eventObj = g.GetComponent<TimelineEventObj>(); entity.eventObj = g.GetComponent<TimelineEventObj>();
entity.track = (int)(g.transform.localPosition.y / LayerHeight() * -1); entity.track = entity.eventObj.GetTrack();
} }
@ -653,12 +652,12 @@ namespace HeavenStudio.Editor.Track
public float SnapToLayer(float y) public float SnapToLayer(float y)
{ {
float size = LayerHeight(); float size = LayerHeight();
return Mathf.Clamp(Mathp.Round2Nearest(y, size), -size * 3, 0); return Mathf.Clamp(Mathp.Round2Nearest(y, size), -size * 3f, 0f);
} }
public float LayerHeight() public float LayerHeight()
{ {
return LayersRect.rect.height / 4; return LayersRect.rect.height / 4f;
} }
public void SetPlaybackSpeed(float speed) public void SetPlaybackSpeed(float speed)

View file

@ -42,7 +42,6 @@ namespace HeavenStudio.Editor.Track
private bool resizingLeft; private bool resizingLeft;
private bool resizingRight; private bool resizingRight;
private bool inResizeRegion; private bool inResizeRegion;
public Vector2 lastMovePos;
public bool isCreating; public bool isCreating;
public string eventObjID; public string eventObjID;
@ -60,8 +59,6 @@ namespace HeavenStudio.Editor.Track
Destroy(resizeGraphic.gameObject); Destroy(resizeGraphic.gameObject);
} }
lastMovePos = transform.localPosition;
// what the fuck???? // what the fuck????
// moveTemp = new GameObject(); // moveTemp = new GameObject();
// moveTemp.transform.SetParent(this.transform.parent); // moveTemp.transform.SetParent(this.transform.parent);
@ -199,6 +196,9 @@ namespace HeavenStudio.Editor.Track
} }
else if (resizingLeft) else if (resizingLeft)
{ {
if (moving)
moving = false;
SetPivot(new Vector2(1, rectTransform.pivot.y)); SetPivot(new Vector2(1, rectTransform.pivot.y));
Vector2 sizeDelta = rectTransform.sizeDelta; Vector2 sizeDelta = rectTransform.sizeDelta;
@ -214,6 +214,9 @@ namespace HeavenStudio.Editor.Track
} }
else if (resizingRight) else if (resizingRight)
{ {
if (moving)
moving = false;
Vector2 sizeDelta = rectTransform.sizeDelta; Vector2 sizeDelta = rectTransform.sizeDelta;
Vector2 mousePos; Vector2 mousePos;
@ -288,8 +291,6 @@ namespace HeavenStudio.Editor.Track
} }
moving = true; moving = true;
// lastMovePos = transform.localPosition;
// OnComplete();
} }
} }
else if (Input.GetMouseButton(1)) else if (Input.GetMouseButton(1))
@ -406,7 +407,7 @@ namespace HeavenStudio.Editor.Track
private void OnMove() private void OnMove()
{ {
if (GameManager.instance.Beatmap.entities.FindAll(c => c.beat == this.transform.localPosition.x && c.track == GetTrack()).Count > 0) if (GameManager.instance.Beatmap.entities.FindAll(c => c.beat == this.transform.localPosition.x && c.track == GetTrack() && c != this.entity).Count > 0)
{ {
eligibleToMove = false; eligibleToMove = false;
} }
@ -467,7 +468,7 @@ namespace HeavenStudio.Editor.Track
public int GetTrack() public int GetTrack()
{ {
return (int)(this.transform.localPosition.y / Timeline.instance.LayerHeight()) * -1; return (int)Mathf.Round(this.transform.localPosition.y / Timeline.instance.LayerHeight()) * -1;
} }
private void OnDestroy() private void OnDestroy()