Exemple #1
0
        public void OnPointerEnter(PointerEventData eventData)
        {
            if (string.IsNullOrEmpty(text))
            {
                Tooltip.Close();
                return;
            }

            var model = TextTooltipViewModel.instance;

            model.text  = text;
            currentText = text;

            TooltipAnchorTarget target;

            if (this.anchorToMouse)
            {
                target = TooltipAnchorTarget.ForMouse(this.followMouse);
            }
            else if (this.transform is RectTransform)
            {
                target = TooltipAnchorTarget.ForUIObject(this.transform as RectTransform, this.tooltipPivotInRectTransform);
            }
            else
            {
                target = TooltipAnchorTarget.ForWorldObject(this.transform);
            }

            Tooltip.Open(model, target);
            pointerInside = true;
        }
Exemple #2
0
        public void OnPointerEnter(PointerEventData eventData)
        {
            var model = TextTooltipViewModel.instance;

            model.text = text;

            TooltipAnchorTarget target;

            if (this.anchorToMouse)
            {
                target = TooltipAnchorTarget.ForMouse(this.followMouse);
            }
            else if (this.transform is RectTransform)
            {
                target = TooltipAnchorTarget.ForUIObject(this.transform as RectTransform, this.tooltipPivotInRectTransform);
            }
            else
            {
                target = TooltipAnchorTarget.ForWorldObject(this.transform);
            }

            Tooltip.Open(model, target);
        }