public override void HandleEvent(EventBase evt) { if (evt.eventTypeId == AttachToPanelEvent.TypeId() && evt is AttachToPanelEvent attachEvent) { textHandle = attachEvent.destinationPanel.contextType == ContextType.Editor ? TextHandleFactory.GetEditorHandle() : TextHandleFactory.GetRuntimeHandle(); #if UNITY_EDITOR (attachEvent.destinationPanel as BaseVisualElementPanel)?.OnTextElementAdded(this); #endif } else if (evt.eventTypeId == DetachFromPanelEvent.TypeId() && evt is DetachFromPanelEvent detachEvent) { #if UNITY_EDITOR (detachEvent.originPanel as BaseVisualElementPanel)?.OnTextElementRemoved(this); #endif } base.HandleEvent(evt); }
private void OnAttachToPanel(AttachToPanelEvent e) { m_TextHandle = e.destinationPanel.contextType == ContextType.Editor ? TextHandleFactory.GetEditorHandle() : TextHandleFactory.GetRuntimeHandle(); }