Ejemplo n.º 1
0
 public void OnDrag(PointerEventData eventData)
 {
     if (eventData.button == _button || (eventData.button == _altButton && (_keyCodes == null || _keyCodes.IsPressed())))
     {
         float   scaleValue = eventData.delta.y * _scaleMultiplier;
         Vector3 newScale   = _scaleTransform.localScale.Add(scaleValue);
         if (newScale.LargestComponent() < _maxScale && newScale.SmallestComponent() > _minScale)
         {
             _scaleTransform.localScale = newScale;
         }
     }
 }
 public void OnDrag(PointerEventData eventData)
 {
     if (!(eventData is MetaHandEventData) && eventData.button == _button && (_notPressedKeys == null || !_notPressedKeys.IsPressed()))
     {
         Ray     cameraRay     = eventData.pressEventCamera.ScreenPointToRay(eventData.position);
         Vector3 worldPosition = cameraRay.GetPoint(_beginDistance);
         Vector3 delta         = worldPosition - _priorPointerWorldPosition;
         if (_lookAtYOnDrag)
         {
             _translateTransform.LookAtY(Camera.main.transform.position);
         }
         _translateTransform.Translate(delta, Space.World);
         _priorPointerWorldPosition = worldPosition;
     }
 }