예제 #1
0
        public void InvokeInfo(Point screenPosition, Point startScreenPosition, float scale, ISymbolCache symbolCache,
                               Action <IWidget> widgetCallback)
        {
            var allWidgets = Layers.Select(l => l.Attribution).Where(a => a != null).Concat(Widgets).ToList();

            // First check if a Widget is clicked. In the current design they are always on top of the map.
            var widget = WidgetTouch.GetWidget(screenPosition, startScreenPosition, scale, allWidgets);

            if (widget != null)
            {
                widgetCallback(widget);
                return;
            }

            if (Info == null)
            {
                return;
            }
            var eventArgs = InfoHelper.GetInfoEventArgs(Viewport, screenPosition, scale, InfoLayers, symbolCache);

            if (eventArgs != null)
            {
                Info?.Invoke(this, eventArgs);
            }
        }
예제 #2
0
        public bool InvokeInfo(Point screenPosition, Point startScreenPosition, float scale, ISymbolCache symbolCache,
                               Action <IWidget, Point> widgetCallback, int numTaps)
        {
            var allWidgets = Layers.Select(l => l.Attribution).Where(a => a != null).Concat(Widgets).ToList();

            // First check if a Widget is clicked. In the current design they are always on top of the map.
            var widget = WidgetTouch.GetWidget(screenPosition, startScreenPosition, scale, allWidgets);

            if (widget != null)
            {
                // TODO how should widgetCallback have a handled type thing?
                // Widgets should be iterated through rather than getting a single widget,
                // based on Z index and then called until handled = true; Ordered By highest Z

                widgetCallback(widget, new Point(screenPosition.X / scale, screenPosition.Y / scale));
                return(true);
            }

            if (Info == null)
            {
                return(false);
            }
            var eventArgs = InfoHelper.GetInfoEventArgs(Viewport, screenPosition, scale, InfoLayers, symbolCache, numTaps);

            if (eventArgs != null)
            {
                // TODO Info items should be iterated through rather than getting a single item,
                // based on Z index and then called until handled = true; Ordered By highest Z

                Info?.Invoke(this, eventArgs);
                return(eventArgs.Handled);
            }

            return(false);
        }