| | 1 | | using DCL.Interface; |
| | 2 | | using DCL.Helpers; |
| | 3 | | using DCL.Models; |
| | 4 | | using DCLPlugins.UUIDEventComponentsPlugin.UUIDComponent.Interfaces; |
| | 5 | | using Ray = UnityEngine.Ray; |
| | 6 | |
|
| | 7 | | namespace DCL.Components |
| | 8 | | { |
| | 9 | | public class OnPointerUp : OnPointerEvent |
| | 10 | | { |
| | 11 | | public const string NAME = "pointerUp"; |
| | 12 | |
|
| | 13 | | public override void Report(WebInterface.ACTION_BUTTON buttonId, Ray ray, HitInfo hit) |
| | 14 | | { |
| 3 | 15 | | if (!enabled || !IsVisible()) |
| 1 | 16 | | return; |
| | 17 | |
|
| 2 | 18 | | Model pointerEventModel = this.model as Model; |
| | 19 | |
|
| 2 | 20 | | if (pointerEventModel == null) |
| 0 | 21 | | return; |
| | 22 | |
|
| 2 | 23 | | bool validButton = pointerEventModel.button == "ANY" || buttonId.ToString() == pointerEventModel.button; |
| | 24 | |
|
| 2 | 25 | | if (IsAtHoverDistance(hit.distance) && validButton) |
| | 26 | | { |
| 2 | 27 | | string meshName = pointerEventHandler.GetMeshName(hit.collider); |
| 2 | 28 | | string entityId = Environment.i.world.sceneController.entityIdHelper.GetOriginalId(entity.entityId); |
| | 29 | |
|
| 2 | 30 | | WebInterface.ReportOnPointerUpEvent(buttonId, scene.sceneData.id, pointerEventModel.uuid, |
| | 31 | | entityId, meshName, ray, hit.point, hit.normal, hit.distance); |
| | 32 | | } |
| 2 | 33 | | } |
| | 34 | |
|
| | 35 | | public override int GetClassId() |
| | 36 | | { |
| 1 | 37 | | return (int) CLASS_ID_COMPONENT.UUID_ON_UP; |
| | 38 | | } |
| | 39 | |
|
| | 40 | | public override PointerInputEventType GetEventType() |
| | 41 | | { |
| 9 | 42 | | return PointerInputEventType.UP; |
| | 43 | | } |
| | 44 | | } |
| | 45 | | } |