Hexgrid GetHexgrid()
        {
            var margin = Margin.OffsetSize();

            return(IsTransposed ? new TransposedHexgrid(Model.GridSize.Scale(MapScale), margin)
                          : new Hexgrid(Model.GridSize.Scale(MapScale), margin));
        }
        /// <inheritdoc/>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            OnHotspotHexChange(new HexEventArgs(GetHexCoords(e.Location - Margin.OffsetSize())));

            base.OnMouseMove(e);
        }
예제 #3
0
        ///// <summary>Return new AutoScrollPosition for applied muse-wheel scroll.</summary>
        //static Point WheelPanel(ScrollProperties scroll, int delta, ref int remainder,
        //  Func<int,Point> newAutoScroll)
        //{
        //  if (Math.Sign(delta) != Math.Sign(remainder)) remainder = 0;
        //  var steps = (delta+remainder)
        //            / (SystemInformation.MouseWheelScrollDelta / SystemInformation.MouseWheelScrollLines);
        //  remainder = (delta+remainder)
        //            % (SystemInformation.MouseWheelScrollDelta / SystemInformation.MouseWheelScrollLines);
        //  return newAutoScroll(scroll.SmallChange * steps);
        //}
        ///// <summary>TODO</summary>
        //static ScrollEventArgs GetScrollEventArgs(bool isHorizontal, Point oldScroll, Point newScroll) {
        //  return new ScrollEventArgs(
        //    ScrollEventType.ThumbTrack,
        //    isHorizontal ? -oldScroll.X : -oldScroll.Y,
        //    isHorizontal ? -newScroll.X : -newScroll.Y,
        //    isHorizontal ? ScrollOrientation.HorizontalScroll : ScrollOrientation.VerticalScroll
        //  );
        //}

        IHexgrid GetHexgrid()
        => new Hexgrid(IsTransposed, Model.GridSize, MapScale, Margin.OffsetSize());
예제 #4
0
        ///// <summary>Return new AutoScrollPosition for applied muse-wheel scroll.</summary>
        //static Point WheelPanel(ScrollProperties scroll, int delta, ref int remainder,
        //  Func<int,Point> newAutoScroll)
        //{
        //  if (Math.Sign(delta) != Math.Sign(remainder)) remainder = 0;
        //  var steps = (delta+remainder)
        //            / (SystemInformation.MouseWheelScrollDelta / SystemInformation.MouseWheelScrollLines);
        //  remainder = (delta+remainder)
        //            % (SystemInformation.MouseWheelScrollDelta / SystemInformation.MouseWheelScrollLines);
        //  return newAutoScroll(scroll.SmallChange * steps);
        //}
        ///// <summary>TODO</summary>
        //static ScrollEventArgs GetScrollEventArgs(bool isHorizontal, Point oldScroll, Point newScroll) {
        //  return new ScrollEventArgs(
        //    ScrollEventType.ThumbTrack,
        //    isHorizontal ? -oldScroll.X : -oldScroll.Y,
        //    isHorizontal ? -newScroll.X : -newScroll.Y,
        //    isHorizontal ? ScrollOrientation.HorizontalScroll : ScrollOrientation.VerticalScroll
        //  );
        //}

        /// <summary>TODO</summary>
        //public void SetModel(IMapDisplayWinForms model) {
        //  Model = model;
        //}

        IHexgrid GetHexgrid()
        {
            var margin = Margin.OffsetSize();

            return(TransposableHexgrid.GetNewGrid(IsTransposed, Model.GridSize, MapScale, margin));
        }