private void AddPointerCanvas(IPointableCanvas pointerCanvas)
        {
            Action <PointerArgs> pointerCanvasAction = (args) => HandlePointerEvent(pointerCanvas.Canvas, args);

            _pointerCanvasActionMap.Add(pointerCanvas, pointerCanvasAction);
            pointerCanvas.WhenPointerEventRaised += pointerCanvasAction;
        }
        private void RemovePointerCanvas(IPointableCanvas pointerCanvas)
        {
            Action <PointerArgs> pointerCanvasAction = _pointerCanvasActionMap[pointerCanvas];

            _pointerCanvasActionMap.Remove(pointerCanvas);
            pointerCanvas.WhenPointerEventRaised -= pointerCanvasAction;

            List <int> pointerIDs = new List <int>(_pointerMap.Keys);

            foreach (int pointerID in pointerIDs)
            {
                Pointer pointer = _pointerMap[pointerID];
                if (pointer.Canvas != pointerCanvas.Canvas)
                {
                    continue;
                }
                ClearPointerSelection(pointer.PointerEventData);
                pointer.MarkForDeletion();
                _pointersForDeletion.Add(pointer);
                _pointerMap.Remove(pointerID);
            }
        }
 public static void RegisterPointableCanvas(IPointableCanvas pointerCanvas)
 {
     Assert.IsNotNull(Instance, "A PointableCanvasModule is required in the scene.");
     Instance.AddPointerCanvas(pointerCanvas);
 }
 public static void UnregisterPointableCanvas(IPointableCanvas pointerCanvas)
 {
     Instance?.RemovePointerCanvas(pointerCanvas);
 }
Beispiel #5
0
 protected virtual void Awake()
 {
     PointableCanvas = _pointableCanvas as IPointableCanvas;
 }