mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-03-24 11:24:52 -05:00
* SceneView switch * VRM10ControllerEditor を分割 * VRM10/Editor/Components/VRM10ControllerSceneView.cs * LookAtEditor, SpringBoneEditor * VRM10SpringBoneColliderGroup and VRM10SpringBone to VRM10ControllerSpringBone. not MonoBehaviour * ReorderableList * VRM10Window.cs * SpringBoneTreeView * ScrollView * rename * VRM10SpringBoneColliderEditor * SelectedGUIBase * spring name * VRM10SpringBoneCollider gizmo to handle * SelectedGUI * 再度、VRM10SpringBoneColliderGroup を MonoBehaviour へ。SerializedObject の参照の都合
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace UniVRM10
|
|
{
|
|
public class ScrollView
|
|
{
|
|
Vector2 m_scrollPosition;
|
|
|
|
public void Draw(float height, Action content, Action repaint)
|
|
{
|
|
m_scrollPosition = EditorGUILayout.BeginScrollView(m_scrollPosition);
|
|
|
|
// mouse wheel scroll part 1
|
|
var isScroll = Event.current.isScrollWheel;
|
|
if (isScroll)
|
|
{
|
|
m_scrollPosition += Event.current.delta * EditorGUIUtility.singleLineHeight;
|
|
if (m_scrollPosition.y < 0)
|
|
{
|
|
m_scrollPosition = Vector2.zero;
|
|
}
|
|
}
|
|
|
|
content();
|
|
|
|
// mouse wheel scroll part 2
|
|
var bottom = EditorGUILayout.GetControlRect();
|
|
if (isScroll)
|
|
{
|
|
var maxScroll = bottom.y - (height - EditorGUIUtility.singleLineHeight * 2);
|
|
// Debug.Log($"{bottom.y}: {this.position.size.y}: {maxScroll}");
|
|
if (m_scrollPosition.y > maxScroll)
|
|
{
|
|
m_scrollPosition = new Vector2(0, maxScroll);
|
|
}
|
|
repaint();
|
|
}
|
|
|
|
EditorGUILayout.EndScrollView();
|
|
}
|
|
}
|
|
}
|