Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
simulator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
simulator
Commits
1487f8b1
Commit
1487f8b1
authored
5 years ago
by
eric.boise
Committed by
Martins Mozeiko
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix resize on full screen visualization
parent
0a2e6bde
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Assets/Scripts/Components/Visualizer.cs
+11
-6
11 additions, 6 deletions
Assets/Scripts/Components/Visualizer.cs
Assets/Scripts/Components/VisualizerWindowResize.cs
+8
-8
8 additions, 8 deletions
Assets/Scripts/Components/VisualizerWindowResize.cs
with
19 additions
and
14 deletions
Assets/Scripts/Components/Visualizer.cs
+
11
−
6
View file @
1487f8b1
...
...
@@ -5,10 +5,9 @@
*
*/
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Linq
;
using
UnityEngine
;
using
UnityEngine.Rendering
;
using
UnityEngine.UI
;
namespace
Simulator.Sensors.UI
...
...
@@ -46,6 +45,7 @@ namespace Simulator.Sensors.UI
private
float
headerAnchoredYPos
=
0f
;
private
RectTransform
rootRT
;
private
List
<
VisualizerWindowResize
>
windowResizers
;
public
WindowSizeType
CurrentWindowSizeType
{
get
;
private
set
;
}
=
WindowSizeType
.
Window
;
...
...
@@ -57,22 +57,25 @@ namespace Simulator.Sensors.UI
HeaderRT
.
gameObject
.
SetActive
(
false
);
ContractTextGO
.
SetActive
(
false
);
ExpandTextGO
.
SetActive
(
false
);
windowSize
=
new
Vector2
(
240f
,
135
f
);
windowSize
=
new
Vector2
(
Screen
.
width
/
8f
,
Screen
.
height
/
8
f
);
fullSize
=
new
Vector2
(
Screen
.
width
,
Screen
.
height
);
rt
=
GetComponent
<
RectTransform
>();
rt
.
sizeDelta
=
windowSize
;
headerAnchoredYPos
=
HeaderRT
.
anchoredPosition
.
y
;
CurrentWindowSizeType
=
WindowSizeType
.
Window
;
UpdateWindowSize
((
int
)
CurrentWindowSizeType
);
CameraRawImage
=
CameraVisualGO
.
GetComponentInChildren
<
RawImage
>();
cameraRT
=
CameraVisualGO
.
GetComponent
<
RectTransform
>();
ValuesText
=
ValuesVisualGO
.
GetComponent
<
Text
>();
fitter
=
CameraVisualGO
.
GetComponentInChildren
<
AspectRatioFitter
>();
windowResizers
=
GetComponentsInChildren
<
VisualizerWindowResize
>(
true
).
ToList
();
windowResizers
.
ForEach
(
win
=>
win
.
gameObject
.
SetActive
(
true
));
CameraVisualGO
.
SetActive
(
false
);
ValuesVisualGO
.
SetActive
(
false
);
UpdateWindowSize
((
int
)
CurrentWindowSizeType
);
}
private
void
OnEnable
()
{
ExitButton
.
onClick
.
AddListener
(
ExitButtonOnClick
);
...
...
@@ -161,6 +164,7 @@ namespace Simulator.Sensors.UI
HeaderRT
.
anchoredPosition
=
new
Vector2
(
0f
,
headerAnchoredYPos
);
ContractTextGO
.
SetActive
(
false
);
ExpandTextGO
.
SetActive
(
true
);
windowResizers
.
ForEach
(
win
=>
win
.
gameObject
.
SetActive
(
true
));
break
;
case
WindowSizeType
.
Full
:
rt
.
sizeDelta
=
fullSize
;
...
...
@@ -168,6 +172,7 @@ namespace Simulator.Sensors.UI
HeaderRT
.
anchoredPosition
=
new
Vector2
(
0f
,
-
headerAnchoredYPos
);
ContractTextGO
.
SetActive
(
true
);
ExpandTextGO
.
SetActive
(
false
);
windowResizers
.
ForEach
(
win
=>
win
.
gameObject
.
SetActive
(
false
));
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/Components/VisualizerWindowResize.cs
+
8
−
8
View file @
1487f8b1
...
...
@@ -6,25 +6,25 @@
*/
using
UnityEngine
;
using
UnityEngine.UI
;
using
UnityEngine.EventSystems
;
using
Simulator.Sensors.UI
;
public
class
VisualizerWindowResize
:
MonoBehaviour
,
IPointerDownHandler
,
IDragHandler
{
public
Vector2
minSize
;
public
Vector2
maxSize
;
public
RectTransform
ParentRT
;
private
Vector3
currentPointerPosition
;
private
Vector3
previousPointerPosition
;
public
RectTransform
headerRT
;
private
RectTransform
rootRT
;
public
RectTransform
headerRT
;
private
Vector3
currentPointerPosition
;
private
Vector3
previousPointerPosition
;
private
Vector2
minSize
;
private
Vector2
maxSize
;
private
void
Awake
()
{
minSize
=
new
Vector2
(
Screen
.
width
/
8f
,
Screen
.
height
/
8f
);
maxSize
=
new
Vector2
(
Screen
.
width
,
Screen
.
height
-
headerRT
.
rect
.
max
.
y
*
2f
);
rootRT
=
SimulatorManager
.
Instance
.
UIManager
.
VisualizerCanvasGO
.
GetComponent
<
RectTransform
>();
maxSize
=
new
Vector2
(
Screen
.
width
,
Screen
.
height
-
headerRT
.
rect
.
max
.
y
*
2
);
}
public
void
OnPointerDown
(
PointerEventData
data
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment