Class CanvasUI
  Displays and manage events of a given scenario
Responsible of undoing/redoing commands on the scenario
Events : The canvas subscribes to events coming for the layers it manages
    Inheritance
    
    
    Focusable
    
    CanvasUI
   
  
  Assembly: Xareus.Scenarios.Unity.Edition.dll
  Syntax
  
    [Serializable]
public class CanvasUI : VisualElement
   
  Constructors
  
  CanvasUI()
  
  
  Declaration
  
  Fields
  MAX_ZOOM
  
  
  Declaration
  
    public static readonly float MAX_ZOOM
   
  Field Value
  
  MIN_ZOOM
  
  
  Declaration
  
    public static readonly float MIN_ZOOM
   
  Field Value
  
  grid
  
  
  Declaration
  
    public BackgroundGrid grid
   
  Field Value
  
  Properties
  
  ArcSourceNode
  
  
  Declaration
  
    public NodeUI ArcSourceNode { get; }
   
  Property Value
  
  
  CanvasTexture
  
  
  Declaration
  
    public Texture2D CanvasTexture { get; }
   
  Property Value
  
  
  CurrentLayer
  
  
  Declaration
  
    public LayerUI CurrentLayer { get; }
   
  Property Value
  
  
  IsCreatingArc
  Indicates if the canvas is currently in the process of building an arc
Declaration
  
    public bool IsCreatingArc { get; }
   
  Property Value
  
  
  IsPlaying
  Is the canvas displaying a scenario that is currently playing ?
Declaration
  
    public bool IsPlaying { get; }
   
  Property Value
  
  
  LayerIds
  
  
  Declaration
  
    public List<string> LayerIds { get; }
   
  Property Value
  
  
  MousePosition
  Access to the last known mouse position.
This is necessary because during some events, the mouse position in the current event is wrong
Declaration
  
    public Vector2 MousePosition { get; set; }
   
  Property Value
  
  
  Played
  
  
  Declaration
  
    public bool Played { get; set; }
   
  Property Value
  
  
  Position
  
  
  Declaration
  
    public Vector2 Position { get; set; }
   
  Property Value
  
  
  ScenarioId
  
  
  Declaration
  
    public string ScenarioId { get; }
   
  Property Value
  
  
  ScenarioTabHandler
  
  
  Declaration
  
    public ScenarioTabHandler ScenarioTabHandler { get; }
   
  Property Value
  
  
  ScenarioWrapper
  Access to the scenario within the canvas
Declaration
  
    public ScenarioWrapper ScenarioWrapper { get; set; }
   
  Property Value
  
  
  SelectedUIElements
  Access to canvas current selection. This can include the temporary selection being performed
Declaration
  
    public HashSet<AClickableElementUI> SelectedUIElements { get; set; }
   
  Property Value
  
  
  Zoom
  
  
  Declaration
  
    public float Zoom { get; set; }
   
  Property Value
  
  Methods
  
  AddLayer(string)
  Adds a layer to the current list
Declaration
  
    public void AddLayer(string id)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | string | id |  | 
    
  
  
  AddToSelection(AClickableElementUI, bool)
  Select the given GUI element
Declaration
  
    protected void AddToSelection(AClickableElementUI elementUI, bool temporary = false)
   
  Parameters
  
  
  BusinessToViewCoordinates(Vector2)
  Converts coordinates from the business to the view.
Business coordinates are the value stored within the XML.
View coordinates are values displayed within the canvas. They depend on zoom and canvas position.
Declaration
  
    public Vector2 BusinessToViewCoordinates(Vector2 businessCoordinates)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Vector2 | businessCoordinates |  | 
    
  
  Returns
  
  
  CheckNodesVisibility()
  
  
  Declaration
  
    protected void CheckNodesVisibility()
   
  
  CheckReload()
  
  
  Declaration
  
    protected void CheckReload()
   
  
  ComputeClosestNodePosition()
  
  
  Declaration
  
    public Vector2 ComputeClosestNodePosition()
   
  Returns
  
  
  ComputeNodesCenterOfGravity()
  Computes and returns the position of the center of gravity of the current layer.
Declaration
  
    public Vector2 ComputeNodesCenterOfGravity()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | Vector2 | Vector2 of the coordinates of the center of gravity of the current layer. | 
    
  
  
  ConvertFromSystem(Vector2, Vector2, float)
  Converts coordinates from another system.
It removes offset and zoom from the source.
Declaration
  
    public static Vector2 ConvertFromSystem(Vector2 source, Vector2 offset, float zoom)
   
  Parameters
  
  Returns
  
  
  ConvertToSystem(Vector2, Vector2, float)
  Converts coordinates to another system.
It adds an offset and a zoom to the source.
Declaration
  
    public static Vector2 ConvertToSystem(Vector2 source, Vector2 offset, float zoom)
   
  Parameters
  
  Returns
  
  
  CopySelectedNodesToClipboard()
  Copy the selected nodes data into the system clipboard
Declaration
  
    public bool CopySelectedNodesToClipboard()
   
  Returns
  
  
  CreateArcPreview(ArcStartedEvent)
  
  
  Declaration
  
    public void CreateArcPreview(ArcStartedEvent args)
   
  Parameters
  
  
  Delete(AClickableElementUI)
  Delete all selected nodes
Declaration
  
    protected void Delete(AClickableElementUI elementUI)
   
  Parameters
  
  
  DeleteSelected()
  Delete all selected nodes
Declaration
  
    public void DeleteSelected()
   
  
  Deselect(AClickableElementUI, bool)
  Deselect the given GUI Element
Declaration
  
    protected void Deselect(AClickableElementUI elementUI, bool temporary = false)
   
  Parameters
  
  
  DeselectAll()
  Deselect everything in the canvas
Declaration
  
    public void DeselectAll()
   
  
  DoReload()
  
  
  Declaration
  
    protected void DoReload()
   
  
  DuplicateSelectedNodes(Vector2)
  Duplicate the selected nodes
Declaration
  
    public bool DuplicateSelectedNodes(Vector2 duplicatePosition)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Vector2 | duplicatePosition |  | 
    
  
  Returns
  
  
  GetLayer(string)
  Get the layer from the local cache.
Creates it if absent
Declaration
  
    public LayerUI GetLayer(string id)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | string | id |  | 
    
  
  Returns
  
  
  HandleElementsUISelection(IEnumerable<AClickableElementUI>, bool)
  Select the given UI Elements
Declaration
  
    protected void HandleElementsUISelection(IEnumerable<AClickableElementUI> uiElements, bool temporary = false)
   
  Parameters
  
  
  InvertElementUISelection(AClickableElementUI, bool)
  Invert the given UI Element selection state
Declaration
  
    protected void InvertElementUISelection(AClickableElementUI elementUI, bool temporary = false)
   
  Parameters
  
  
  InvertElementsUISelection(IEnumerable<AClickableElementUI>, bool)
  Invert the given UI Elements selection state
Declaration
  
    protected void InvertElementsUISelection(IEnumerable<AClickableElementUI> elementsUI, bool temporary = false)
   
  Parameters
  
  
  MoveSelection(Vector2)
  
  
  Declaration
  
    public void MoveSelection(Vector2 mouseDelta)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Vector2 | mouseDelta |  | 
    
  
  
  OnExecuteCommand(ExecuteCommandEvent)
  
  
  Declaration
  
    protected void OnExecuteCommand(ExecuteCommandEvent evt)
   
  Parameters
  
  
  OnKeyDown(KeyDownEvent)
  
  
  Declaration
  
    protected void OnKeyDown(KeyDownEvent evt)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | KeyDownEvent | evt |  | 
    
  
  
  OnValidateCommand(ValidateCommandEvent)
  
  
  Declaration
  
    protected void OnValidateCommand(ValidateCommandEvent evt)
   
  Parameters
  
  
  PasteFromClipboard(Vector2)
  Try to past the data from the system clipboard
Declaration
  
    public bool PasteFromClipboard(Vector2 position)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Vector2 | position |  | 
    
  
  Returns
  
  
  Reload()
  Ask for a complete reload of the canvas. If multiple reloads are requested at the same frame, onely one will occur
Declaration
  
  
  RemoveLastLayer()
  Remove the last layer if possible
Declaration
  
    public void RemoveLastLayer()
   
  
  Reselect()
  Redo the selection to resend the events
Declaration
  
  
  ResetArcPreview()
  
  
  Declaration
  
    public void ResetArcPreview()
   
  
  SaveSelectedElementsIds()
  
  
  Declaration
  
    public void SaveSelectedElementsIds()
   
  
  SelectElementUI(AClickableElementUI)
  Select the given UI Element
Declaration
  
    protected void SelectElementUI(AClickableElementUI elementUI)
   
  Parameters
  
  
  SelectElementsUI(IEnumerable<AClickableElementUI>, bool)
  Select the given UI Element
Declaration
  
    protected void SelectElementsUI(IEnumerable<AClickableElementUI> elementsUi, bool additive = false)
   
  Parameters
  
  
  SelectMovableUIElements(IEnumerable<string>, bool)
  Select the given MovableUIElements
Declaration
  
    protected void SelectMovableUIElements(IEnumerable<string> movableIds, bool additive = false)
   
  Parameters
  
  
  SelectParentLayer()
  
  
  Declaration
  
    public void SelectParentLayer()
   
  
  Serialize(IEnumerable<AMovableElementUI>)
  
  
  Declaration
  
    public static string Serialize(IEnumerable<AMovableElementUI> movableElements)
   
  Parameters
  
  Returns
  
  
  SetSelectedElementsIdentifiables(IEnumerable<Identifiable>)
  
  
  Declaration
  
    public void SetSelectedElementsIdentifiables(IEnumerable<Identifiable> identifiables)
   
  Parameters
  
  
  SetSelectedElementsIds(IEnumerable<string>)
  
  
  Declaration
  
    public void SetSelectedElementsIds(IEnumerable<string> identifiables)
   
  Parameters
  
  
  StopPlaying()
  
  
  Declaration
  
    public void StopPlaying()
   
  
  Update()
  
  
  Declaration
  
  
  UpdateTransitionFilter(Type, string)
  
  
  Declaration
  
    public void UpdateTransitionFilter(Type currentFilterType, string currentFilter)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Type | currentFilterType |  | 
      
        | string | currentFilter |  | 
    
  
  
  ViewToBusinessCoordinates(Vector2)
  Converts coordinates from the view to the business.
View coordinates are values displayed within the canvas. They depend on zoom and canvas position.
Business coordinates are the value stored within the XML.
Declaration
  
    public Vector2 ViewToBusinessCoordinates(Vector2 viewCoordinates)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Vector2 | viewCoordinates |  | 
    
  
  Returns
  
  Events
  ArcCreated
  Signal emitted when an arc is created
Declaration
  
    public event EventHandler<ArcCreatedEvent> ArcCreated
   
  Event Type
  
  ComplexSequenceDoubleClicked
  Signal emitted when a sub complex sequence is opened
Declaration
  
    public event EventHandler<string> ComplexSequenceDoubleClicked
   
  Event Type
  
    
      
        | Type | Description | 
    
    
      
        | EventHandler<string> |  | 
    
  
  DeselectedAll
  Signal emitted when nothing is selected
Declaration
  
    public event EventHandler<DeselectedEventArgs> DeselectedAll
   
  Event Type
  
  ExternalScenarioDoubleClicked
  Signal emitted when an external scenario must be opened
Declaration
  
    public event EventHandler<ExternalScenarioUI> ExternalScenarioDoubleClicked
   
  Event Type
  
  LayerChanged
  Signal emitted when the current layer is changed
Declaration
  
    public event EventHandler LayerChanged
   
  Event Type
  
    
      
        | Type | Description | 
    
    
      
        | EventHandler |  | 
    
  
  RemoveAllLayers
  Signal emitted when all layers of the canvas must be removed
Declaration
  
    public event EventHandler RemoveAllLayers
   
  Event Type
  
    
      
        | Type | Description | 
    
    
      
        | EventHandler |  | 
    
  
  ScenarioDataChanged
  Signal emitted when a command is executed
Declaration
  
    public event EventHandler<ScenarioDataChangedEventArgs> ScenarioDataChanged
   
  Event Type
  
  SelectionUpdated
  Signal emitted when the UI Elements selection changed
Declaration
  
    public event EventHandler<IEnumerable<AClickableElementUI>> SelectionUpdated
   
  Event Type