public bool OnPointerUp(Vector3 position, MeasureToolStateData data) { Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetObjectPicker, AnchorPicker)); OnPick(position); if (m_Results == null || m_Results.Count == 0) { return(false); } var selectedObjects = m_Results.Select(x => x.Item1).Where(x => x.layer != MetadataFilter.k_OtherLayer); data.selectedAnchorsContext = selectedObjects.Select(r => r.GetComponent <AnchorSelectionContext>()).Where(g => g != null).ToList(); Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetMeasureToolOptions, data)); return(true); }
public void OnStateDataChanged(MeasureToolStateData data, GameObject cursor = null) { if (m_CachedMeasureToolStateData != data) { if (m_CachedMeasureToolStateData == null || m_CachedMeasureToolStateData.Value.selectedAnchorsContext != data.selectedAnchorsContext) { if (data.selectedAnchorsContext != null && data.selectedAnchorsContext.Count > 0) { var anchor = data.selectedAnchorsContext[0].LastContext.selectedAnchor; if (cursor != null) { SetCursorUI(anchor, ref cursor); if (!cursor.activeSelf) { cursor.gameObject.SetActive(true); m_AnchorsList.Add(anchor); } m_AnchorIndexToCursorObject.Add(new Tuple <int, GameObject>(m_AnchorsList.Count - 1, cursor)); m_CurrentSelectedAnchorIndex = m_AnchorIndexToCursorObject[m_AnchorIndexToCursorObject.Count - 1].Item1; if (!UIStateManager.current.stateData.VREnable) { m_DraggablePad.gameObject.SetActive(true); } } else if ((UIStateManager.current.stateData.VREnable || m_DraggablePad.button.IsActive()) && m_CurrentSelectedAnchorIndex != null) { var currentCursor = m_AnchorIndexToCursorObject.Where(r => r.Item1 == m_CurrentSelectedAnchorIndex).Select(r => r.Item2).FirstOrDefault(); SetCursorUI(anchor, ref currentCursor); m_AnchorsList[m_CurrentSelectedAnchorIndex.Value] = anchor; } data.selectedAnchorsContext[0].SelectionContextList.Clear(); } } m_CachedMeasureToolStateData = data; } }