public bool Begin(bool hasChanged, Rect position) { if (hasChanged) { this.m_Valid = false; } if (Event.current.type == EventType.Repaint) { if (GUIUtility.keyboardControl != this.m_KeyboardControl) { this.m_Valid = false; this.m_KeyboardControl = GUIUtility.keyboardControl; } if (DragAndDrop.activeControlID != this.m_ActiveDragControl) { this.m_Valid = false; this.m_ActiveDragControl = DragAndDrop.activeControlID; } if (GUI.color != this.m_GUIColor) { this.m_Valid = false; this.m_GUIColor = GUI.color; } position = GUIClip.Unclip(position); if (this.m_Valid && (position != this.m_Rect)) { this.m_Rect = position; this.m_Valid = false; } if (!EditorGUI.isCollectingTooltips) { if (this.m_Valid) { return(false); } this.m_Recording = true; this.BeginRecording(); } return(true); } if (Event.current.type == EventType.Used) { return(false); } if (Event.current.type != EventType.Used) { this.m_WatchForUsed = true; } return(true); }
public static Vector2 WorldToGUIPoint(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera current = Camera.current; if (current) { Vector2 vector = current.WorldToScreenPoint(world); vector.y = (float)Screen.height - vector.y; vector = EditorGUIUtility.PixelsToPoints(vector); return(GUIClip.Clip(vector)); } return(new Vector2(world.x, world.y)); }
void HandleComponentScreenshot(Rect content, Editor editor) { if (ScreenShots.s_TakeComponentScreenshot) { content.yMin -= 16; if (content.Contains(Event.current.mousePosition)) { Rect globalComponentRect = GUIClip.Unclip(content); globalComponentRect.position = globalComponentRect.position + inspectorWindow.m_Parent.screenPosition.position; ScreenShots.ScreenShotComponent(globalComponentRect, editor.target); } } }
public static Ray GUIPointToWorldRay(Vector2 position) { if (!Camera.current) { Debug.LogError("Unable to convert GUI point to world ray if a camera has not been set up!"); return(new Ray(Vector3.zero, Vector3.forward)); } Vector2 vector = GUIClip.Unclip(position); vector.y = (float)Screen.height - vector.y; Camera current = Camera.current; return(current.ScreenPointToRay(new Vector2(vector.x, vector.y))); }
public void OnBatchMode() { var m_WebViewRect = GUIClip.Unclip(new Rect(0, 0, position.width, position.height)); // If we haven't initialize our embedded webview yet, // do so now. if (m_InitialOpenURL != null) { if (!webView) { InitWebView(m_WebViewRect); } } }
protected bool MouseOnTopOfInspector() { bool result; if (!this.hasSelected) { result = false; } else { Vector2 point = GUIClip.Unclip(this.eventSystem.current.mousePosition) - (GUIClip.topmostRect.position - GUIClip.GetTopRect().position); result = this.inspectorRect.Contains(point); } return(result); }
public override void Repaint(Event e) { this.ValidateLayout(); this.stylePainter.repaintEvent = e; this.PaintSubTree(e, this.visualTree, Matrix4x4.identity, this.visualTree.position); if (base.panelDebug != null) { GUIClip.Internal_Push(this.visualTree.position, Vector2.zero, Vector2.zero, true); if (base.panelDebug.EndRepaint()) { this.visualTree.Dirty(ChangeType.Repaint); } GUIClip.Internal_Pop(); } }
// Convert world space point to a 2D GUI position. // Use this version in critical loops. internal static Vector3 WorldToGUIPointWithDepth(Vector3 world, Camera camera, Matrix4x4 matrixHandles, float screenHeight) { world = matrixHandles.MultiplyPoint(world); if (camera) { Vector3 pos = camera.WorldToScreenPoint(world); pos.y = screenHeight - pos.y; Vector2 points = EditorGUIUtility.PixelsToPoints(pos); points = GUIClip.Clip(points); return(new Vector3(points.x, points.y, pos.z)); } return(world); }
static void DrawTrackStateBox(Rect trackRect, TrackAsset track) { var styles = DirectorStyles.Instance; bool locked = track.locked && !TimelineUtility.IsLockedFromGroup(track); bool muted = track.muted && !TimelineUtility.IsParentMuted(track); bool allSubTrackMuted = TimelineUtility.IsAllSubTrackMuted(track); GUIContent content = null; if (locked && muted) { content = Styles.s_LockedAndMuted; if (!allSubTrackMuted) { content = Styles.s_LockedAndPartiallyMuted; } } else if (locked) { content = Styles.s_Locked; } else if (muted) { content = Styles.s_Muted; if (!allSubTrackMuted) { content = Styles.s_PartiallyMuted; } } // the track could be locked, but we only show the 'locked portion' on the upper most track // that is causing the lock if (content == null) { return; } Rect textRect = Graphics.CalculateTextBoxSize(trackRect, styles.fontClip, content, WindowConstants.overlayTextPadding); TimelineWindow.instance.OverlayDrawData.Add( OverlayDrawer.CreateTextBoxOverlay( GUIClip.Unclip(textRect), content.text, styles.fontClip, Color.white, styles.customSkin.colorLockTextBG, styles.displayBackground)); }
public static Vector2 EndScrollView() { GUIClip.Pop(); Rect rect = PreviewGUI.s_Position; Rect rect2 = PreviewGUI.s_Position; Rect rect3 = PreviewGUI.s_ViewRect; Vector2 result = PreviewGUI.s_ScrollPos; EventType type = Event.current.type; if (type != EventType.Layout) { if (type != EventType.Used) { bool flag = (int)rect3.width > (int)rect.width; bool flag2 = (int)rect3.height > (int)rect.height; int controlID = GUIUtility.GetControlID(PreviewGUI.sliderHash, FocusType.Passive); if (flag2) { GUIStyle gUIStyle = "PreHorizontalScrollbar"; GUIStyle thumb = "PreHorizontalScrollbarThumb"; float num = (rect3.width - rect.width) * 0.5f; result.x = GUI.Slider(new Rect(rect2.x, rect2.yMax - gUIStyle.fixedHeight, rect.width - ((!flag) ? 0f : gUIStyle.fixedHeight), gUIStyle.fixedHeight), result.x, rect.width + num, -num, rect3.width, gUIStyle, thumb, true, controlID); } else { result.x = 0f; } controlID = GUIUtility.GetControlID(PreviewGUI.sliderHash, FocusType.Passive); if (flag) { GUIStyle gUIStyle2 = "PreVerticalScrollbar"; GUIStyle thumb2 = "PreVerticalScrollbarThumb"; float num2 = (rect3.height - rect.height) * 0.5f; result.y = GUI.Slider(new Rect(rect.xMax - gUIStyle2.fixedWidth, rect.y, gUIStyle2.fixedWidth, rect.height), result.y, rect.height + num2, -num2, rect3.height, gUIStyle2, thumb2, false, controlID); } else { result.y = 0f; } } } else { GUIUtility.GetControlID(PreviewGUI.sliderHash, FocusType.Passive); GUIUtility.GetControlID(PreviewGUI.sliderHash, FocusType.Passive); } return(result); }
// Convert world space point to a 2D GUI position. public static Vector3 WorldToGUIPointWithDepth(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera cam = Camera.current; if (cam) { Vector3 pos = cam.WorldToScreenPoint(world); pos.y = Screen.height - pos.y; Vector2 points = EditorGUIUtility.PixelsToPoints(pos); points = GUIClip.Clip(points); return(new Vector3(points.x, points.y, pos.z)); } return(world); }
public static void AddCursorRect(Rect position, MouseCursor mouse, int controlID) { if (Event.current.type == EventType.Repaint) { Rect rect = GUIClip.Unclip(position); Rect topmostRect = GUIClip.topmostRect; float xmin = Mathf.Max(rect.x, topmostRect.x); float ymin = Mathf.Max(rect.y, topmostRect.y); float xmax = Mathf.Min(rect.xMax, topmostRect.xMax); Rect r = Rect.MinMaxRect(xmin, ymin, xmax, Mathf.Min(rect.yMax, topmostRect.yMax)); if ((r.width > 0f) && (r.height > 0f)) { Internal_AddCursorRect(r, mouse, controlID); } } }
public void HandlePing() { if (isPinging) { float totalTime = m_ZoomTime + m_WaitTime + m_FadeOutTime; float t = (Time.realtimeSinceStartup - m_TimeStart); if (t > 0.0f && t < totalTime) { Color c = GUI.color; Matrix4x4 m = GUI.matrix; if (t < m_ZoomTime) { float peakTime = m_ZoomTime / 2f; float scale = (m_PeakScale - 1f) * (((m_ZoomTime - Mathf.Abs(peakTime - t)) / peakTime) - 1f) + 1f; Matrix4x4 mat = GUI.matrix; // If the content is only partly visible, the zoom pivot point is moved to right border. This avoids the nasty artefacts. Vector2 pivotPoint = m_ContentRect.xMax < m_AvailableWidth ? m_ContentRect.center : new Vector2(m_AvailableWidth, m_ContentRect.center.y); Vector2 point = GUIClip.Unclip(pivotPoint); Matrix4x4 newMat = Matrix4x4.TRS(point, Quaternion.identity, new Vector3(scale, scale, 1)) * Matrix4x4.TRS(-point, Quaternion.identity, Vector3.one); GUI.matrix = newMat * mat; } else if (t > m_ZoomTime + m_WaitTime) { float alpha = (totalTime - t) / m_FadeOutTime; GUI.color = new Color(c.r, c.g, c.b, c.a * alpha); } if (m_ContentDraw != null && Event.current.type == EventType.Repaint) { Rect backRect = m_ContentRect; backRect.x -= m_PingStyle.padding.left; backRect.y -= m_PingStyle.padding.top; m_PingStyle.Draw(backRect, GUIContent.none, false, false, false, false); m_ContentDraw(m_ContentRect); } GUI.matrix = m; GUI.color = c; } else { m_TimeStart = -1f; } } }
public static Vector2 WorldToGUIPoint(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera cam = Camera.current; if (cam) { Vector2 pos = cam.WorldToScreenPoint(world); pos.y = Screen.height - pos.y; pos = EditorGUIUtility.PixelsToPoints(pos); return(GUIClip.Clip(pos)); } else { return(new Vector2(world.x, world.y)); } }
internal void ApplyAndForget() { if (layoutCache.layoutGroups != null) { GUILayoutUtility.current.CopyState(layoutCache); GUI.skin = skin; GUIUtility.s_OriginalID = instanceID; if (scrollViewStates != null) { GUI.scrollViewStates = scrollViewStates; } Internal_ApplySavedGUIState(guiState, screenManagerSize); GUIClip.Reapply(); } }
public void HandlePing() { if (this.isPinging) { float num = this.m_ZoomTime + this.m_WaitTime + this.m_FadeOutTime; float num2 = Time.realtimeSinceStartup - this.m_TimeStart; if (num2 > 0f && num2 < num) { Color color = GUI.color; Matrix4x4 matrix = GUI.matrix; if (num2 < this.m_ZoomTime) { float num3 = this.m_ZoomTime / 2f; float num4 = (this.m_PeakScale - 1f) * ((this.m_ZoomTime - Mathf.Abs(num3 - num2)) / num3 - 1f) + 1f; Matrix4x4 matrix2 = GUI.matrix; Vector2 pos = (this.m_ContentRect.xMax >= this.m_AvailableWidth) ? new Vector2(this.m_AvailableWidth, this.m_ContentRect.center.y) : this.m_ContentRect.center; Vector2 vector = GUIClip.Unclip(pos); Matrix4x4 lhs = Matrix4x4.TRS(vector, Quaternion.identity, new Vector3(num4, num4, 1f)) * Matrix4x4.TRS(-vector, Quaternion.identity, Vector3.one); GUI.matrix = lhs * matrix2; } else { if (num2 > this.m_ZoomTime + this.m_WaitTime) { float num5 = (num - num2) / this.m_FadeOutTime; GUI.color = new Color(color.r, color.g, color.b, color.a * num5); } } if (this.m_ContentDraw != null && Event.current.type == EventType.Repaint) { Rect contentRect = this.m_ContentRect; contentRect.x -= (float)this.m_PingStyle.padding.left; contentRect.y -= (float)this.m_PingStyle.padding.top; this.m_PingStyle.Draw(contentRect, GUIContent.none, false, false, false, false); this.m_ContentDraw(this.m_ContentRect); } GUI.matrix = matrix; GUI.color = color; } else { this.m_TimeStart = -1f; } } }
public virtual void OnGUI(Rect rect, float xScroll) { Event current = Event.current; if (this.m_GUIView == null) { this.m_GUIView = GUIView.current; } this.DetectSizeChanges(rect); if (this.m_ResizeToFit && current.type == EventType.Repaint) { this.m_ResizeToFit = false; this.ResizeColumnsWidthsProportionally(rect.width - GUI.skin.verticalScrollbar.fixedWidth - this.state.widthOfAllVisibleColumns); } GUIClip.Push(rect, new Vector2(-xScroll, 0f), Vector2.zero, false); Rect totalHeaderRect = new Rect(0f, 0f, rect.width, rect.height); float widthOfAllVisibleColumns = this.state.widthOfAllVisibleColumns; float width = ((totalHeaderRect.width <= widthOfAllVisibleColumns) ? widthOfAllVisibleColumns : totalHeaderRect.width) + GUI.skin.verticalScrollbar.fixedWidth; Rect position = new Rect(0f, 0f, width, totalHeaderRect.height); GUI.Label(position, GUIContent.none, MultiColumnHeader.DefaultStyles.background); if (current.type == EventType.ContextClick && position.Contains(current.mousePosition)) { current.Use(); this.DoContextMenu(); } this.UpdateColumnHeaderRects(totalHeaderRect); for (int i = 0; i < this.state.visibleColumns.Length; i++) { int num = this.state.visibleColumns[i]; MultiColumnHeaderState.Column column = this.state.columns[num]; Rect headerRect = this.m_ColumnRects[i]; Rect dividerRect = new Rect(headerRect.xMax - 1f, headerRect.y + 4f, 1f, headerRect.height - 8f); Rect position2 = new Rect(dividerRect.x - this.m_DividerWidth * 0.5f, totalHeaderRect.y, this.m_DividerWidth, totalHeaderRect.height); bool flag; column.width = EditorGUI.WidthResizer(position2, column.width, column.minWidth, column.maxWidth, out flag); if (flag && current.type == EventType.Repaint) { this.DrawColumnResizing(headerRect, column); } this.DrawDivider(dividerRect, column); this.ColumnHeaderGUI(column, headerRect, num); } GUIClip.Pop(); }
void UserOverlaysGUI() { if (Event.current.type != EventType.Repaint) { return; } // the rect containing the time area plus the time ruler var screenRect = new Rect( state.sequencerHeaderWidth, WindowConstants.timeAreaYPosition, position.width - state.sequencerHeaderWidth - (treeView != null && treeView.showingVerticalScrollBar ? WindowConstants.sliderWidth : 0), position.height - WindowConstants.timeAreaYPosition - horizontalScrollbarHeight); var startTime = state.PixelToTime(screenRect.xMin); var endTime = state.PixelToTime(screenRect.xMax); using (new GUIViewportScope(screenRect)) { foreach (var entry in m_OverlayQueue) { var uiState = MarkerUIStates.None; if (entry.isCollapsed) { uiState |= MarkerUIStates.Collapsed; } if (entry.isSelected) { uiState |= MarkerUIStates.Selected; } var region = new MarkerOverlayRegion(GUIClip.Clip(entry.rect), screenRect, startTime, endTime); try { entry.editor.DrawOverlay(entry.marker, uiState, region); } catch (Exception e) { Debug.LogException(e); } } } m_OverlayQueue.Clear(); }
public void RenderToHMDOnly() { ConfigureTargetTexture((int)targetSize.x, (int)targetSize.y); if (m_TargetTexture.IsCreated()) { var gizmos = false; var targetDisplay = 0; var sendInput = false; EditorGUIUtility.RenderGameViewCamerasInternal( m_TargetTexture, targetDisplay, GUIClip.Unclip(viewInWindow), Vector2.zero, gizmos, sendInput); } }
public static Ray GUIPointToWorldRay(Vector2 position) { Ray result; if (!Camera.current) { Debug.LogError("Unable to convert GUI point to world ray if a camera has not been set up!"); result = new Ray(Vector3.zero, Vector3.forward); } else { Vector2 position2 = GUIClip.Unclip(position); Vector2 vector = EditorGUIUtility.PointsToPixels(position2); vector.y = (float)Screen.height - vector.y; Camera current = Camera.current; result = current.ScreenPointToRay(new Vector2(vector.x, vector.y)); } return(result); }
private float DrawTab(Rect tabRegionRect, GUIStyle tabStyle, int tabIndex, float xPos) { float tabWidth = GetTabWidth(tabStyle, tabIndex); Rect tabPositionRect = new Rect(xPos, tabRegionRect.yMin + tabStyle.margin.top, tabWidth, tabRegionRect.height); float roundedPosX = Mathf.Round(tabPositionRect.x); float roundedWidth = Mathf.Round(tabPositionRect.x + tabPositionRect.width) - roundedPosX; bool isActive = m_Panes[tabIndex] == EditorWindow.focusedWindow; Rect tabContentRect = new Rect(roundedPosX, tabPositionRect.y, roundedWidth, tabPositionRect.height); tabStyle.Draw(tabContentRect, tabContentRect.Contains(Event.current.mousePosition), isActive, tabIndex == selected, false); GUI.Label(tabPositionRect, GetTruncatedTabContent(tabIndex), Styles.tabLabel); var unclippedContentRect = GUIClip.UnclipToWindow(tabContentRect); MarkHotRegion(unclippedContentRect); return(tabWidth); }
public void OnGUI() { Rect webViewRect = GUIClip.Unclip(new Rect(0f, 0f, base.position.width, base.position.height)); if (!this.m_WebView) { this.InitWebView(webViewRect); } if (Event.current.type == EventType.Layout) { this.m_WebView.SetSizeAndPosition((int)webViewRect.x, (int)webViewRect.y, (int)webViewRect.width, (int)webViewRect.height); if (this.m_CurrentSkin != EditorGUIUtility.skinIndex) { this.m_CurrentSkin = EditorGUIUtility.skinIndex; this.InvokeJSMethod("document.AssetStore", "refreshSkinIndex", new object[0]); } this.UpdateDockStatusIfNeeded(); } }
static void DrawMuteOverlay(DrawData data) { DirectorStyles styles = TimelineWindow.styles; var colorOverlay = OverlayDrawer.CreateColorOverlay(GUIClip.Unclip(data.contentRect), styles.customSkin.colorTrackDarken); colorOverlay.Draw(); Rect textRect = Graphics.CalculateTextBoxSize(data.contentRect, styles.fontClip, k_Muted, WindowConstants.overlayTextPadding); var boxOverlay = OverlayDrawer.CreateTextBoxOverlay( GUIClip.Unclip(textRect), k_Muted.text, styles.fontClip, Color.white, styles.customSkin.colorLockTextBG, styles.displayBackground); boxOverlay.Draw(); }
void DrawOverlay(OverlayData overlayData) { Rect overlayRect = GUIClip.Clip(overlayData.rect); if (overlayData.types == OverlayDataTypes.BackgroundColor) { EditorGUI.DrawRect(overlayRect, overlayData.color); } else if (overlayData.types == OverlayDataTypes.BackgroundTexture) { Graphics.DrawTextureRepeated(overlayRect, overlayData.texture); } else if (overlayData.types == OverlayDataTypes.TextBox) { using (new GUIColorOverride(overlayData.backgroundTextStyle.normal.textColor)) GUI.Box(overlayRect, GUIContent.none, overlayData.backgroundTextStyle); Graphics.ShadowLabel(overlayRect, GUIContent.Temp(overlayData.text), overlayData.textStyle, overlayData.textStyle.normal.textColor, Color.black); } }
internal static GameObject PickGameObjectDelegated(Vector2 position, GameObject[] ignore, GameObject[] filter, out int materialIndex) { Camera current = Camera.current; int cullingMask = current.cullingMask; position = GUIClip.Unclip(position); position = EditorGUIUtility.PointsToPixels(position); position.y = (float)Screen.height - position.y - current.pixelRect.yMin; materialIndex = -1; GameObject gameObject = null; if (HandleUtility.pickClosestGameObjectDelegate != null) { gameObject = HandleUtility.pickClosestGameObjectDelegate(current, cullingMask, position, ignore, filter, out materialIndex); } if (gameObject == null) { gameObject = HandleUtility.Internal_PickClosestGO(current, cullingMask, position, ignore, filter, out materialIndex); } return gameObject; }
public void HandlePing() { if (!this.isPinging) { return; } float num1 = this.m_ZoomTime + this.m_WaitTime + this.m_FadeOutTime; float num2 = Time.realtimeSinceStartup - this.m_TimeStart; if ((double)num2 > 0.0 && (double)num2 < (double)num1) { Color color = GUI.color; Matrix4x4 matrix1 = GUI.matrix; if ((double)num2 < (double)this.m_ZoomTime) { float num3 = this.m_ZoomTime / 2f; float num4 = (float)(((double)this.m_PeakScale - 1.0) * (((double)this.m_ZoomTime - (double)Mathf.Abs(num3 - num2)) / (double)num3 - 1.0) + 1.0); Matrix4x4 matrix2 = GUI.matrix; Vector2 vector2 = GUIClip.Unclip((double)this.m_ContentRect.xMax >= (double)this.m_AvailableWidth ? new Vector2(this.m_AvailableWidth, this.m_ContentRect.center.y) : this.m_ContentRect.center); GUI.matrix = Matrix4x4.TRS((Vector3)vector2, Quaternion.identity, new Vector3(num4, num4, 1f)) * Matrix4x4.TRS((Vector3)(-vector2), Quaternion.identity, Vector3.one) * matrix2; } else if ((double)num2 > (double)this.m_ZoomTime + (double)this.m_WaitTime) { float num3 = (num1 - num2) / this.m_FadeOutTime; GUI.color = new Color(color.r, color.g, color.b, color.a * num3); } if (this.m_ContentDraw != null && Event.current.type == EventType.Repaint) { Rect contentRect = this.m_ContentRect; contentRect.x -= (float)this.m_PingStyle.padding.left; contentRect.y -= (float)this.m_PingStyle.padding.top; this.m_PingStyle.Draw(contentRect, GUIContent.none, false, false, false, false); this.m_ContentDraw(this.m_ContentRect); } GUI.matrix = matrix1; GUI.color = color; } else { this.m_TimeStart = -1f; } }
public void Render(VisualTreeAsset vta, Rect r, GUIStyle background) { if (Event.current.type == EventType.Repaint && (r.width >= 100f || r.height >= 100f)) { bool flag = false; if (vta != this.m_LastTree || !this.m_LastTree) { this.m_LastTree = vta; this.m_Tree = vta.CloneTree(null); this.m_Tree.StretchToParentSize(); flag = true; } if (this.m_Panel == null) { UXMLEditorFactories.RegisterAll(); this.m_Panel = UIElementsUtility.FindOrCreatePanel(this.m_LastTree, ContextType.Editor, new DataWatchService()); if (this.m_Panel.visualTree.styleSheets == null) { UIElementsEditorUtility.AddDefaultEditorStyleSheets(this.m_Panel.visualTree); this.m_Panel.visualTree.LoadStyleSheetsFromPaths(); } this.m_Panel.allowPixelCaching = false; flag = true; } if (flag) { this.m_Panel.visualTree.Clear(); this.m_Panel.visualTree.Add(this.m_Tree); } EditorGUI.DrawRect(r, (!EditorGUIUtility.isProSkin) ? HostView.kViewColor : EditorGUIUtility.kDarkViewBackground); this.m_Panel.visualTree.layout = GUIClip.UnclipToWindow(r); this.m_Panel.visualTree.Dirty(ChangeType.Layout); this.m_Panel.visualTree.Dirty(ChangeType.Repaint); SavedGUIState savedGUIState = SavedGUIState.Create(); for (int i = GUIClip.Internal_GetCount(); i > 0; i--) { GUIClip.Pop(); } this.m_Panel.Repaint(Event.current); savedGUIState.ApplyAndForget(); } }
protected void DoTextureGUI() { if (m_Texture == null) { return; } // zoom startup init if (m_Zoom < 0f) { m_Zoom = GetMinZoom(); } // Texture rect in view space m_TextureRect = new Rect( m_TextureViewRect.width / 2f - (m_Texture.width * m_Zoom / 2f), m_TextureViewRect.height / 2f - (m_Texture.height * m_Zoom / 2f), (m_Texture.width * m_Zoom), (m_Texture.height * m_Zoom) ); HandleScrollbars(); SetupHandlesMatrix(); DrawScreenspaceBackground(); GUIClip.Push(m_TextureViewRect, -m_ScrollPosition, Vector2.zero, false); if (Event.current.type == EventType.Repaint) { DrawTexturespaceBackground(); DrawTexture(); DrawGizmos(); } DoTextureGUIExtras(); GUIClip.Pop(); // Handle this after DoTextureGUIExtras in case user wants any event that is handled by Zoom or Panning HandleZoom(); HandlePanning(); }
private bool TitleBarButton(GUIStyle style) { var buttonRect = new Rect(m_TitleBarWidth - Styles.borderSize - (buttonHorizontalSpace * ++m_ButtonCount), Styles.buttonTop, kButtonWidth, kButtonHeight); var guiView = rootView as GUIView; if (guiView == null) { var splitView = rootView as SplitView; if (splitView != null) { guiView = splitView.children.Length > 0 ? splitView.children[0] as GUIView : null; } } if (guiView != null) { guiView.MarkHotRegion(GUIClip.UnclipToWindow(buttonRect)); } return(GUI.Button(buttonRect, GUIContent.none, style)); }
public void OnGUI() { Rect webViewRect = GUIClip.Unclip(new Rect(0f, 0f, base.position.width, base.position.height)); if (this.m_RepeatedShow-- > 0) { this.Refresh(); } if (this.m_InitialOpenURL != null) { if (this.webView == null) { this.InitWebView(webViewRect); } if (Event.current.type == EventType.Layout) { this.webView.SetSizeAndPosition((int)webViewRect.x, (int)webViewRect.y, (int)webViewRect.width, (int)webViewRect.height); } } }