Time scale: Added context menu to time scale, so it is possible to reset slider to 1.0

This commit is contained in:
Anders Ejlersen 2025-03-29 17:19:16 +01:00
parent dd80d46ebb
commit 29ab1a90a0
4 changed files with 18 additions and 1 deletions

View file

@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.11.1] - 2024-11-25
### Added
- Added context menu to time scale, so it is possible to reset slider to 1.0
## [1.11.0] - 2025-03-29 ## [1.11.0] - 2025-03-29
### Changed ### Changed

View file

@ -1,6 +1,7 @@
using JetBrains.Annotations; using JetBrains.Annotations;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UTools = UnityEditor.Tools;
namespace Module.NavigationTool.Editor.Toolbar namespace Module.NavigationTool.Editor.Toolbar
{ {

View file

@ -28,6 +28,16 @@ namespace Module.NavigationTool.Editor.Toolbar
EditorGUI.LabelField(r0, LABEL_TIME_SCALE, styles.centeredMiniLabel); EditorGUI.LabelField(r0, LABEL_TIME_SCALE, styles.centeredMiniLabel);
EditorGUI.LabelField(r2, LABEL_TIME_VALUE, styles.centeredMiniLabel); EditorGUI.LabelField(r2, LABEL_TIME_VALUE, styles.centeredMiniLabel);
if (Event.current.keyCode == KeyCode.Mouse1 && rect.Contains(Event.current.mousePosition))
{
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Reset"), false, () => Time.timeScale = 1f);
menu.ShowAsContext();
Event.current.Use();
}
float temp = GUI.HorizontalSlider(r1, value, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue); float temp = GUI.HorizontalSlider(r1, value, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue);
temp = Mathf.Clamp(temp, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue); temp = Mathf.Clamp(temp, ToolbarTimeSettings.TimeScaleMinValue, ToolbarTimeSettings.TimeScaleMaxValue);

View file

@ -1,6 +1,6 @@
{ {
"name": "com.module.navigationtool", "name": "com.module.navigationtool",
"version": "1.11.0", "version": "1.11.1",
"displayName": "Module.NavigationTool", "displayName": "Module.NavigationTool",
"description": "Support for navigation tools, like favorites, history and toolbars", "description": "Support for navigation tools, like favorites, history and toolbars",
"unity": "2019.2", "unity": "2019.2",