block resizing

This commit is contained in:
Braedon Lewis 2023-09-27 00:06:15 -04:00
parent c6519bd00c
commit 6a6cf72574
11 changed files with 803 additions and 1630 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1127
m_Height: 633
m_Width: 1600
m_Height: 900
m_AntiAliasing: 2
m_MipCount: -1
m_DepthStencilFormat: 92

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1690
m_Height: 949
m_Width: 2400
m_Height: 1350
m_AntiAliasing: 1
m_MipCount: -1
m_DepthStencilFormat: 92

View file

@ -33,7 +33,7 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1

View file

@ -4355,8 +4355,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0.18000007, y: 0}
m_AnchoredPosition: {x: 1, y: 0}
m_SizeDelta: {x: 6, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &184364177
MonoBehaviour:
@ -4408,8 +4408,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 798021450}
m_TargetAssemblyTypeName: RhythmHeavenMania.Editor.TimelineEventObj, Assembly-CSharp
m_MethodName: DragEnter
m_TargetAssemblyTypeName: HeavenStudio.Editor.Track.TimelineEventObj, Assembly-CSharp
m_MethodName: ResizeEnter
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
@ -4424,8 +4424,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 798021450}
m_TargetAssemblyTypeName: RhythmHeavenMania.Editor.TimelineEventObj, Assembly-CSharp
m_MethodName: DragExit
m_TargetAssemblyTypeName: HeavenStudio.Editor.Track.TimelineEventObj, Assembly-CSharp
m_MethodName: ResizeExit
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
@ -4643,7 +4643,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -399.99994, y: 0}
m_AnchoredPosition: {x: -400, y: 0}
m_SizeDelta: {x: -800.0001, y: 194}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &195260752
@ -7138,7 +7138,7 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 9.95
m_fontSize: 14
m_fontSizeBase: 14.3
m_fontWeight: 400
m_enableAutoSizing: 1
@ -16032,11 +16032,11 @@ RectTransform:
m_Father: {fileID: 1791483803}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: -45, y: -110}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 486, y: -110}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &683816223
MonoBehaviour:
m_ObjectHideFlags: 0
@ -18668,7 +18668,6 @@ MonoBehaviour:
selected: 0
mouseHovering: 0
resizable: 0
resizing: 0
moving: 0
wasDuplicated: 0
isCreating: 0
@ -25084,7 +25083,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 142.53061}
m_AnchoredPosition: {x: 0, y: 162.32657}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &1154875945
@ -29981,7 +29980,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -399.99994, y: 0}
m_AnchoredPosition: {x: -400, y: 0}
m_SizeDelta: {x: -800.0001, y: 194}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1426168094
@ -33860,8 +33859,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1220118245}
m_HandleRect: {fileID: 1220118244}
m_Direction: 2
m_Value: 1.0000004
m_Size: 0.78268224
m_Value: 1.0000017
m_Size: 0.9467054
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
@ -40882,7 +40881,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2046851079}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -40892,8 +40891,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0.000019073486}
m_SizeDelta: {x: 0.18, y: 0}
m_AnchoredPosition: {x: -1, y: 0.000019073486}
m_SizeDelta: {x: 6, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2046851081
MonoBehaviour:
@ -40983,8 +40982,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 798021450}
m_TargetAssemblyTypeName: RhythmHeavenMania.Editor.TimelineEventObj, Assembly-CSharp
m_MethodName: DragEnter
m_TargetAssemblyTypeName: HeavenStudio.Editor.Track.TimelineEventObj, Assembly-CSharp
m_MethodName: ResizeEnter
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
@ -40999,8 +40998,8 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 798021450}
m_TargetAssemblyTypeName: RhythmHeavenMania.Editor.TimelineEventObj, Assembly-CSharp
m_MethodName: DragExit
m_TargetAssemblyTypeName: HeavenStudio.Editor.Track.TimelineEventObj, Assembly-CSharp
m_MethodName: ResizeExit
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

View file

@ -1,8 +1,8 @@
using System;
public static class AppInfo {
public const string Version = "0.0.992";
public static readonly DateTime Date = new DateTime(2023, 09, 25, 20, 37, 15, 570, DateTimeKind.Utc);
public const string Version = "0.0.994";
public static readonly DateTime Date = new DateTime(2023, 09, 27, 02, 57, 22, 019, DateTimeKind.Utc);
}

View file

@ -606,13 +606,13 @@ namespace HeavenStudio.Editor.Track
}
RealTimelineContent.sizeDelta = new Vector2(RealTimelineContent.sizeDelta.x, LayerHeight() * LayerCount);
TimelineBlockManager.Instance.UpdateMarkers();
BoxSelection.instance.LayerSelectUpdate();
}
public void LateUpdate()
{
TimelineBlockManager.Instance.UpdateMarkers();
BoxSelection.instance.LayerSelectUpdate();
TimelineContent.anchoredPosition = RealTimelineContent.anchoredPosition;
TopPanelContent.anchoredPosition = new Vector2(TimelineContent.anchoredPosition.x, TopPanelContent.anchoredPosition.y);

View file

@ -44,12 +44,15 @@ namespace HeavenStudio.Editor.Track
public bool selected;
public bool mouseHovering;
public bool resizable;
public bool resizing;
public bool moving;
public bool wasDuplicated;
public bool resizing => resizingLeft || resizingRight;
private bool resizingLeft;
private bool resizingRight;
private bool inResizeRegion;
private float resizingLeftBL;
public bool isCreating;
private bool altWhenClicked = false;
@ -138,7 +141,7 @@ namespace HeavenStudio.Editor.Track
Timeline.instance.MousePos2Beat.IsWithin((float)entity.beat, (float)entity.beat + entity.length) &&
Timeline.instance.MousePos2Layer == (int)entity["track"];
eventLabel.overflowMode = (mouseHovering || moving) ? TextOverflowModes.Overflow : TextOverflowModes.Ellipsis;
eventLabel.overflowMode = (mouseHovering || moving || resizing || inResizeRegion) ? TextOverflowModes.Overflow : TextOverflowModes.Ellipsis;
if (selected)
{
@ -162,27 +165,25 @@ namespace HeavenStudio.Editor.Track
if (selected)
{
selected = false;
selectedImage.gameObject.SetActive(false);
outline.color = new Color32(0, 0, 0, 51);
}
return;
}
if (resizing)
if (resizingRight)
{
if (moving) moving = false;
if (resizingLeft) SetPivot(new Vector2(1, rectTransform.pivot.y));
Vector2 sizeDelta = rectTransform.sizeDelta;
Vector2 mousePos;
entity.length = Mathf.Max(Timeline.instance.MousePos2BeatSnap - (float)entity.beat, Timeline.instance.snapInterval);
SetWidthHeight();
}
else if (resizingLeft)
{
if (moving) moving = false;
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, Input.mousePosition, Editor.instance.EditorCamera, out mousePos);
sizeDelta = new Vector2((resizingLeft ? -mousePos.x : mousePos.x) + 0.15f, sizeDelta.y);
sizeDelta = new Vector2(Mathf.Clamp(sizeDelta.x, Timeline.SnapInterval(), resizingLeft ? rectTransform.localPosition.x : Mathf.Infinity), sizeDelta.y);
rectTransform.sizeDelta = new Vector2(Mathp.Round2Nearest(sizeDelta.x, Timeline.SnapInterval()), sizeDelta.y);
SetPivot(new Vector2(0, rectTransform.pivot.y));
entity.beat = Mathf.Min(Timeline.instance.MousePos2BeatSnap, resizingLeftBL - Timeline.instance.snapInterval);
entity.length = Mathf.Max(resizingLeftBL - (float)entity.beat, Timeline.instance.snapInterval);
SetWidthHeight();
}
else
{
@ -300,19 +301,22 @@ namespace HeavenStudio.Editor.Track
changedSiblingIndex = false;
mouseHovering = true;
selectedImage.gameObject.SetActive(true);
if (!selected && !TimelineBlockManager.Instance.MovingAnyEvents) selectedImage.gameObject.SetActive(true);
}
public void HoverExit()
{
if (changedSiblingIndex)
gameObject.transform.SetSiblingIndex(lastSiblingIndex);
mouseHovering = false;
selectedImage.gameObject.SetActive(false);
}
public void OnDragMain()
{
if (Conductor.instance.NotStopped()) return;
if (Input.GetMouseButton(1) || Input.GetMouseButton(2)) return;
if (!moving)
altWhenClicked = Input.GetKey(KeyCode.LeftAlt);
@ -337,6 +341,9 @@ namespace HeavenStudio.Editor.Track
public void OnDown()
{
if (Conductor.instance.NotStopped()) return;
if (moving) return;
if (Input.GetMouseButton(0) && Timeline.instance.timelineState.selected)
{
if (Input.GetKey(KeyCode.LeftShift))
@ -358,7 +365,7 @@ namespace HeavenStudio.Editor.Track
}
}
}
else
else if (!selected)
Selections.instance.ClickSelect(this);
}
}
@ -394,12 +401,12 @@ namespace HeavenStudio.Editor.Track
#region ResizeEvents
public void DragEnter()
public void ResizeEnter()
{
inResizeRegion = true;
}
public void DragExit()
public void ResizeExit()
{
inResizeRegion = false;
}
@ -409,8 +416,8 @@ namespace HeavenStudio.Editor.Track
if (resizable && selected)
{
ResetResize();
resizing = true;
resizingLeft = true;
resizingLeftBL = (float)entity.beat + entity.length;
}
}
@ -427,7 +434,6 @@ namespace HeavenStudio.Editor.Track
if (resizable && selected)
{
ResetResize();
resizing = true;
resizingRight = true;
}
}
@ -444,7 +450,6 @@ namespace HeavenStudio.Editor.Track
{
resizingLeft = false;
resizingRight = false;
resizing = false;
}
private void SetPivot(Vector2 pivot)
@ -501,12 +506,12 @@ namespace HeavenStudio.Editor.Track
public void OnSelect()
{
selectedImage.gameObject.SetActive(true);
// selectedImage.gameObject.SetActive(true);
}
public void OnDeselect()
{
selectedImage.gameObject.SetActive(false);
// selectedImage.gameObject.SetActive(false);
}
}
}

View file

@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.0.992
bundleVersion: 0.0.994
preloadedAssets:
- {fileID: 102900000, guid: 5348c08b82446e0478cee8bda6c02cfc, type: 3}
metroInputSource: 0
@ -158,11 +158,11 @@ PlayerSettings:
applicationIdentifier:
Standalone: com.RHeavenStudio.Heaven-Studio
buildNumber:
Standalone: 992
Standalone: 994
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
AndroidBundleVersionCode: 992
AndroidBundleVersionCode: 994
AndroidMinSdkVersion: 22
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1