< Summary

Class:DCL.Components.OnPointerDown
Assembly:DCL.Components.Events
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/UUIDEventComponentsPlugin/UUIDComponent/OnPointerDown.cs
Covered lines:11
Uncovered lines:1
Coverable lines:12
Total lines:48
Line coverage:91.6% (11 of 12)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Report(...)0%4.034087.5%
ShouldReportEvent(...)0%440100%
GetClassId()0%110100%
GetEventType()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/UUIDEventComponentsPlugin/UUIDComponent/OnPointerDown.cs

#LineLine coverage
 1using DCL.Interface;
 2using DCL.Helpers;
 3using DCL.Models;
 4using DCLPlugins.UUIDEventComponentsPlugin.UUIDComponent.Interfaces;
 5using Ray = UnityEngine.Ray;
 6
 7namespace DCL.Components
 8{
 9    public class OnPointerDown : OnPointerEvent
 10    {
 11        public const string NAME = "pointerDown";
 12
 13        public override void Report(WebInterface.ACTION_BUTTON buttonId, Ray ray, HitInfo hit)
 14        {
 415            if (!enabled || !IsVisible())
 016                return;
 17
 418            Model model = this.model as OnPointerEvent.Model;
 19
 420            if (ShouldReportEvent(buttonId, hit))
 21            {
 422                string meshName = pointerEventHandler.GetMeshName(hit.collider);
 423                string entityId = Environment.i.world.sceneController.entityIdHelper.GetOriginalId(entity.entityId);
 424                DCL.Interface.WebInterface.ReportOnPointerDownEvent(buttonId, scene.sceneData.sceneNumber, model.uuid,
 25                    entityId, meshName, ray, hit.point, hit.normal, hit.distance);
 26            }
 427        }
 28
 29        public bool ShouldReportEvent(WebInterface.ACTION_BUTTON buttonId, HitInfo hit)
 30        {
 431            Model model = this.model as Model;
 32
 433            return IsVisible() &&
 34                   IsAtHoverDistance(hit.distance) &&
 35                   (model.button == "ANY" || buttonId.ToString() == model.button);
 36        }
 37
 38        public override int GetClassId()
 39        {
 140            return (int) CLASS_ID_COMPONENT.UUID_ON_DOWN;
 41        }
 42
 43        public override PointerInputEventType GetEventType()
 44        {
 1621445            return PointerInputEventType.DOWN;
 46        }
 47    }
 48}