private void HandleBrowserMouseWheelMoved(object sender, MouseWheelEventArgs e)
 {
     //Only fire the mouse wheel moved event if this is the top-most
     //scrolling element in the UI tree.
     if (IsActive())
         this.MouseWheelMoved(this, e);
 }
Exemple #2
0
        public Mouse( IWindow window )
        {
            w = window.Handle as OpenTK.GameWindow;
            w.Mouse.ButtonDown += Mouse_ButtonDown;
            w.Mouse.ButtonUp += Mouse_ButtonUp;
            w.Mouse.Move += Mouse_Move;
            w.Mouse.WheelChanged += Mouse_WheelChanged;

            buttonEvent = new MouseButtonEventArgs ( GetState () );
            wheelEvent = new MouseWheelEventArgs ( 0 );
        }
        /// <summary>
        /// Handles the mouse wheel.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SLExtensions.Controls.MouseWheelEventArgs"/> instance containing the event data.</param>
        private static void HandleMouseWheel(object sender, MouseWheelEventArgs e)
        {
            MultiScaleImage msi = (MultiScaleImage)sender;
            DZContext context = msi.EnsureContext();

            if (!context.IsMouseWheelEnabled)
                return;

            e.Handled = true;
            if (e.Delta > 0)
                msi.Zoom(1.2, context.LastMousePosition);
            else
                msi.Zoom(0.8, context.LastMousePosition);

            context.ClickedImageIndex = -1;
        }
Exemple #4
0
        public Mouse( IWindow window )
        {
            this.window = window;

            Form w = window.Handle as Form;

            w.MouseDown += ButtonDownEvent;
            w.MouseUp += ButtonUpEvent;
            w.MouseMove += MoveEvent;
            w.MouseWheel += WheelEvent;
            w.MouseHover += HoverEvent;
            w.MouseLeave += LeaveEvent;

            buttonEvent = new MouseButtonEventArgs ( new MouseState () );
            wheelEvent = new MouseWheelEventArgs ( 0 );
        }
Exemple #5
0
 internal void MouseWheelChanged(MouseWheelEventArgs e)
 {
     float eDeltaPrecise = e.GetDeltaPrecise();
     if (keyboardState[GetKey(GlKeys.LShift)])
     {
         if (cameratype == CameraType.Overhead)
         {
             overheadcameradistance -= eDeltaPrecise;
             if (overheadcameradistance < TPP_CAMERA_DISTANCE_MIN) { overheadcameradistance = TPP_CAMERA_DISTANCE_MIN; }
             if (overheadcameradistance > TPP_CAMERA_DISTANCE_MAX) { overheadcameradistance = TPP_CAMERA_DISTANCE_MAX; }
         }
         if (cameratype == CameraType.Tpp)
         {
             tppcameradistance -= eDeltaPrecise;
             if (tppcameradistance < TPP_CAMERA_DISTANCE_MIN) { tppcameradistance = TPP_CAMERA_DISTANCE_MIN; }
             if (tppcameradistance > TPP_CAMERA_DISTANCE_MAX) { tppcameradistance = TPP_CAMERA_DISTANCE_MAX; }
         }
     }
     for (int i = 0; i < clientmodsCount; i++)
     {
         if (clientmods[i] == null) { continue; }
         clientmods[i].OnMouseWheelChanged(this, e);
     }
 }
        private void OnMouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (!LargeImageThumb.IsMouseOver)
            {
                return;
            }

            var delta           = e.Delta / 500d;
            var mousePosToImage = e.GetPosition(LargeImage);

            if (delta > 0 && LargeImage.Width > 2 * ImageCanvas.ActualWidth)
            {
                return;
            }
            if (delta < 0 && LargeImage.Width < ImageCanvas.ActualWidth / 4)
            {
                return;
            }

            LargeImage.Width *= 1d + delta;
            LargeImage.Height = LargeImage.Width / ImageScale;

            var movex = mousePosToImage.X;
            var movey = mousePosToImage.Y;

            // 判断鼠标在元素外
            if (movex > LargeImage.ActualWidth || movex < 0)
            {
                movex = LargeImage.Width / 2;
            }
            if (movey > LargeImage.ActualHeight || movey < 0)
            {
                movey = LargeImage.Height / 2;
            }

            //  图片不大于窗格时保证在窗格内
            var nTop  = Canvas.GetTop(LargeImageThumb) - delta * movey;
            var nLeft = Canvas.GetLeft(LargeImageThumb) - delta * movex;

            if (LargeImage.Height <= ImageCanvas.ActualHeight)
            {
                if (nTop <= 0)
                {
                    nTop = 0;
                }
                if (nTop >= ImageCanvas.ActualHeight - LargeImage.Height)
                {
                    nTop = ImageCanvas.ActualHeight - LargeImage.Height;
                }
            }

            if (LargeImage.Width <= ImageCanvas.ActualWidth)
            {
                if (nLeft <= 0)
                {
                    nLeft = 0;
                }
                if (nLeft >= ImageCanvas.ActualWidth - LargeImage.Width)
                {
                    nLeft = ImageCanvas.ActualWidth - LargeImage.Width;
                }
            }

            Canvas.SetLeft(LargeImageThumb, nLeft);
            Canvas.SetTop(LargeImageThumb, nTop);
        }
 void Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs e)
 {
     foreach (MouseEventHandler h in mouseEventHandlers)
     {
         MouseWheelEventArgs args = new MouseWheelEventArgs();
         args.SetDelta(e.Delta);
         args.SetDeltaPrecise(e.DeltaPrecise);
         h.OnMouseWheel(args);
     }
 }
Exemple #8
0
		private static void OnMouseWheel(object sender, MouseWheelEventArgs e)
		{
			if (e.Handled)
				return;

			UIElement element = sender as UIElement;
			if (element == null)
				return;

			AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(element);
			if (peer == null)
				peer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
			if (peer == null)
				return;

			// try to get the scroll provider or the range provider
			IScrollProvider m_ScrollProvider = peer.GetPattern(PatternInterface.Scroll) as IScrollProvider;
			IRangeValueProvider m_RangeValueProvider = null;
			if ((element is Control) && (element as Control).HasFocus())
				m_RangeValueProvider = peer.GetPattern(PatternInterface.RangeValue) as IRangeValueProvider;
			if (m_ScrollProvider == null && m_RangeValueProvider == null)
				return;

			// set scroll amount
			const double kMultiplier = 5.0; // x times the default
			const double kFactor = kMultiplier / (30 * 120);
			double delta = e.Delta;
			delta *= kFactor;
			int direction = Math.Sign(delta);

			bool shiftKey = (Keyboard.Modifiers & ModifierKeys.Shift) != 0;
			bool controlKey = (Keyboard.Modifiers & ModifierKeys.Control) != 0;

			if (m_ScrollProvider != null)
			{
				e.Handled = true;
#if true
				if (m_ScrollProvider.VerticallyScrollable && !controlKey)
				{
					double percent = m_ScrollProvider.VerticalScrollPercent - (delta * m_ScrollProvider.VerticalViewSize);
					if (percent < 0) percent = 0;
					if (percent > 100) percent = 100;
					m_ScrollProvider.SetScrollPercent(m_ScrollProvider.HorizontalScrollPercent, percent);
				}
				else
				if (m_ScrollProvider.HorizontallyScrollable && controlKey)
				{
					double percent = m_ScrollProvider.HorizontalScrollPercent - (delta * m_ScrollProvider.HorizontalViewSize);
					if (percent < 0) percent = 0;
					if (percent > 100) percent = 100;
					m_ScrollProvider.SetScrollPercent(percent, m_ScrollProvider.VerticalScrollPercent);
				}
#else
				ScrollAmount scrollAmount = (direction < 0) ? ScrollAmount.SmallIncrement : ScrollAmount.SmallDecrement;
				if (m_ScrollProvider.VerticallyScrollable && !controlKey)
					m_ScrollProvider.Scroll(ScrollAmount.NoAmount, scrollAmount);
				else
				if (m_ScrollProvider.HorizontallyScrollable && controlKey)
					m_ScrollProvider.Scroll(scrollAmount, ScrollAmount.NoAmount);
#endif
			}

			if (m_RangeValueProvider != null)
			{
				e.Handled = true;
				double newValue = m_RangeValueProvider.Value + (direction < 0 ? -m_RangeValueProvider.LargeChange : m_RangeValueProvider.LargeChange);
				if (newValue >= m_RangeValueProvider.Minimum && newValue <= m_RangeValueProvider.Maximum)
					m_RangeValueProvider.SetValue(newValue);
			}
		}
 public override void OnMouseWheel(MouseWheelEventArgs e)
 {
     l.HandleMouseWheel(e);
 }
 protected override void  OnMouseWheel(MouseWheelEventArgs e)
 {
     //Debug.WriteLine(string.Format("{0} OnMouseWheel: {1}", AxisLabel, e.Delta));
     e.Handled = true;
     var direction = Math.Sign(e.Delta);
     if (IsLogarithmic) VisibleRange.Update(Math.Pow(10, _visibleRange.Min + (0.1 * direction)), Math.Pow(10, _visibleRange.Max - (0.1 * direction)));
 }
Exemple #11
0
        protected override void OnMouseWheel(MouseWheelEventArgs e)
        {
            base.OnMouseWheel(e);

            _controller.MouseScroll(e.Offset);
        }
Exemple #12
0
 private void MouseScrollWheelHandler(object sender, MouseWheelEventArgs e)
 {
     // scroll wheel event is handled by Update method
     e.Handled = true;
     this.pendingScrollWheelDelta = e.Delta;
 }
Exemple #13
0
 private void OnWrapperMouseWheel(object sender, MouseWheelEventArgs e)
 {
     Value += IsSnapToTickEnabled ? (e.Delta < 0 ? -TickFrequency : +TickFrequency)
             : (Maximum - Minimum) * e.Delta / 100d;
 }
Exemple #14
0
 /// <summary>
 ///     Mouse wheel has been moved.
 /// </summary>
 public virtual void MouseWheelMove(MouseWheelEventArgs e)
 {
 }
Exemple #15
0
 private void DataGridView_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
 {
     Scroller.ScrollToVerticalOffset(Scroller.ContentVerticalOffset - e.Delta);
 }
Exemple #16
0
 // Fix to raise MouseWhele event
 private void OnMenuItemMouseWheel(object sender, MouseWheelEventArgs e)
 {
     (((MenuItem)sender).Parent as ListBox)?.RaiseEvent(e);
 }
 void Control_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     Add(e.Delta);
 }
 private void OverlayBorder_OnMouseWheel(object sender, MouseWheelEventArgs e)
 {
     UpdateSpherePosition(e);
 }
 public override void OnMouseWheelChanged(Game game_, MouseWheelEventArgs args)
 {
     float delta = args.GetDeltaPrecise();
     if ((game_.guistate == GuiState.Normal || (game_.guistate == GuiState.Inventory && !IsMouseOverCells()))
         && (!game_.keyboardState[game_.GetKey(GlKeys.LShift)]))
     {
         game_.ActiveMaterial -= game_.platform.FloatToInt(delta);
         game_.ActiveMaterial = game_.ActiveMaterial % 10;
         while (game_.ActiveMaterial < 0)
         {
             game_.ActiveMaterial += 10;
         }
     }
     if (IsMouseOverCells() && game.guistate == GuiState.Inventory)
     {
         if (delta > 0)
         {
             ScrollUp();
         }
         if (delta < 0)
         {
             ScrollDown();
         }
     }
 }
Exemple #20
0
 internal static void TrigMouseWheel(MouseWheelEventArgs e) => MouseWheel?.Invoke(e);
 protected internal override void OnMouseWheelChanged(MouseWheelEventArgs _event)
 {
     base.OnMouseWheelChanged(_event);
     if ((_event.Modifiers & ModifierKeys.Ctrl) == ModifierKeys.Ctrl)
         this.hScrollbar.Value -= _event.Delta * this.ScrollStep;
     else
         this.vScrollbar.Value -= _event.Delta * this.ScrollStep;
 }
 private void sldBalance_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     Slider_MouseWheel(sldBalance, e);
 }
Exemple #23
0
        /// <summary>
        /// Zooms with the mouse wheel.
        /// </summary>
        /// <param name="sender">The Deep Zoom Viewer.</param>
        /// <param name="e">Mouse Wheel Event Args.</param>
        private static void MouseWheelMoved(object sender, MouseWheelEventArgs e)
        {
            DeepZoomViewer viewer = (DeepZoomViewer)sender;
            double zoomFactor = 1.5;
            if (e.Delta < 0)
            {
                zoomFactor = 0.5;
            }

            viewer.Zoom(zoomFactor, viewer.lastMousePos);
        }
 private void sldVolume_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     Slider_MouseWheel(sldVolume, e);
 }
Exemple #25
0
 public abstract void OnMouseWheel(MouseWheelEventArgs e);
Exemple #26
0
 public override void OnMouseWheel(MouseWheelEventArgs args)
 {
     base.OnMouseWheel(args);
     args.SetHandled(true);
 }
Exemple #27
0
 public virtual void OnMouseWheel(MouseWheelEventArgs e)
 {
 }
Exemple #28
0
        /// <summary>
        ///
        /// </summary>
        private void AlphaSlider_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            int change = e.Delta / Math.Abs(e.Delta);

            AlphaSlider.Value = AlphaSlider.Value + (double)change;
        }
            private void HandleMouseWheel(object sender, HtmlEventArgs args)
            {
                double delta = 0;

                    ScriptObject eventObj = args.EventObject;

                    if (eventObj.GetProperty("wheelDelta") != null)
                    {
                        delta = ((double)eventObj.GetProperty("wheelDelta")) / 120;

                        if (HtmlPage.Window.GetProperty("opera") != null)
                            delta = -delta;
                    }
                    else if (eventObj.GetProperty("detail") != null)
                    {
                        delta = -((double)eventObj.GetProperty("detail")) / 3;

                        if (HtmlPage.BrowserInformation.UserAgent.IndexOf("Macintosh") != -1)
                            delta = delta * 3;
                    }

                    if (delta != 0 && this.Moved != null)
                    {
                        MouseWheelEventArgs wheelArgs = new MouseWheelEventArgs(delta);
                        this.Moved(this, wheelArgs);

                        if (wheelArgs.Handled)
                            args.PreventDefault();
                    }
            }
 public MouseWheelEventArguments(MouseWheelEventArgs args) : base(args)
 {
     Wheel = args.Wheel;
 }
        /// <summary>
        /// Handles the mouse wheel.
        /// </summary>
        /// <param name="sender">The deep zoom viewer.</param>
        /// <param name="e">Mouse Wheel Event Args.</param>
        private void DeepZoomViewer_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            double zoomFactor = 1.5;
            if (e.Delta < 0)
            {
                zoomFactor = 0.5;
            }

            this.Zoom(zoomFactor, this.lastMousePos);
        }
 protected override void OnMouseWheel(MouseWheelEventArgs e) =>
 _ttl.Input?.Invoke(new RawMouseWheelEventArgs(_mouse, (uint)e.Timestamp, _inputRoot,
                                               e.GetPosition(this).ToAvaloniaPoint(), new Vector(0, e.Delta), GetModifiers(e)));
Exemple #33
0
 public virtual void OnMouseWheelChanged(MouseWheelEventArgs e)
 {
 }
Exemple #34
0
 /// <summary>
 /// When user uses the mousewheel, update the volume
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">MouseWheelEventArgs</param>
 private void Grid_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     MediaPlayer.Volume += (e.Delta > 0) ? 0.1 : -0.1;
 }
        void mouseWheelHelper_MouseWheelMoved(object source, MouseWheelEventArgs eventArgs)
        {
            // Ctrl+колесо - масштабирование в IE
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                return;
            // Shift+колесо - скроллинг по горизонтали
            if (IsHorizontal)
            {
                if ((Keyboard.Modifiers & ModifierKeys.Shift) != ModifierKeys.Shift)
                    return;
            }
            else
            {
                if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                    return;
            }

            CustomMouseWheelSupport support = source as CustomMouseWheelSupport;
            if (support != null)
            {
                ScrollBar scroller = support.ElementToAddMouseWheelSupportTo as ScrollBar;
                if (scroller != null)
                {
                    var delta = eventArgs.WheelDelta;

                    delta *= ScrollAmount;

                    var newOffset = scroller.Value - delta;

                    if (newOffset > scroller.Maximum)
                        newOffset = scroller.Maximum;
                    else if (newOffset < scroller.Minimum)
                        newOffset = scroller.Minimum;

                    scroller.Value = newOffset;
                }
            }
            eventArgs.BrowserEventHandled = true;
        }
 private void InfoBubble_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     e.Handled = true;
 }
 public override void OnMouseWheel(MouseWheelEventArgs e)
 {
     //menu.p.MessageBoxShowError(menu.p.IntToString(e.GetDelta()), "Delta");
     if (e.GetDelta() < 0)
     {
         //Mouse wheel turned down
         PageUp_();
     }
     else if (e.GetDelta() > 0)
     {
         //Mouse wheel turned up
         PageDown_();
     }
 }
Exemple #38
0
 internal void MouseWheelChanged(MouseWheelEventArgs e)
 {
     float eDeltaPrecise = e.GetDeltaPrecise();
     if (keyboardState[GetKey(GlKeys.LShift)])
     {
         if (cameratype == CameraType.Overhead)
         {
             overheadcameradistance -= eDeltaPrecise;
             if (overheadcameradistance < TPP_CAMERA_DISTANCE_MIN) { overheadcameradistance = TPP_CAMERA_DISTANCE_MIN; }
             if (overheadcameradistance > TPP_CAMERA_DISTANCE_MAX) { overheadcameradistance = TPP_CAMERA_DISTANCE_MAX; }
         }
         if (cameratype == CameraType.Tpp)
         {
             tppcameradistance -= eDeltaPrecise;
             if (tppcameradistance < TPP_CAMERA_DISTANCE_MIN) { tppcameradistance = TPP_CAMERA_DISTANCE_MIN; }
             if (tppcameradistance > TPP_CAMERA_DISTANCE_MAX) { tppcameradistance = TPP_CAMERA_DISTANCE_MAX; }
         }
     }
     for (int i = 0; i < clientmodsCount; i++)
     {
         if (clientmods[i] == null) { continue; }
         clientmods[i].OnMouseWheelChanged(this, e);
     }
     if ((guistate != GuiState.Inventory)
         && (!keyboardState[GetKey(GlKeys.LShift)]))
     {
         ActiveMaterial -= platform.FloatToInt(eDeltaPrecise);
         ActiveMaterial = ActiveMaterial % 10;
         while (ActiveMaterial < 0)
         {
             ActiveMaterial += 10;
         }
     }
 }
Exemple #39
0
		private static void OnClick(object sender, MouseWheelEventArgs e)
		{
		}
Exemple #40
0
 void dev_WheelChanged(object sender, MouseWheelEventArgs e)
 {
     if (e.Delta > 0)
         wheelup += e.Delta;
     else
         wheeldown -= e.Delta;
 }
 public virtual void OnMouseWheelChanged(Game game, MouseWheelEventArgs args) { }
 private void pokeMap_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     sl_mapZoom.Value = pokeMap.Zoom;
 }
 private void Control_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     SetControlAngle(0 - e.Delta, 5);
 }
Exemple #44
0
 void Mouse_Wheel(MouseWheelEventArgs args)
 {
     m_Input.ProcessMouseWheel(args);
 }
 protected override void OnMouseWheel(MouseWheelEventArgs e)
 {
     //base.OnMouseWheel(e);
 }
Exemple #46
0
        private void OnMouseWheel(object sender, MouseWheelEventArgs e)
        {
            double d = e.Delta / 120; // Mouse wheel 1 click (120 delta) = 1 step

            Value += d * Interval;
        }
 protected override void OnMouseWheel(MouseWheelEventArgs e)
 {
     position += direction.Forward * e.Delta * 0.005;
     UpdateCamera();
     e.Handled = true;
 }
Exemple #48
0
 /// <summary>
 /// 滚轮进行放大缩小
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseWheel(MouseWheelEventArgs e)
 {
     base.OnMouseWheel(e);
     PublicMouseWheel(e);
     CrossLineManager.Instance.NotifyPublicMouseWheel(e, this);
 }
        /// <summary>
        /// Handles on mouse wheel.
        /// </summary>
        /// <param name="delta">The delta.</param>
        /// <param name="e">HtmlEvent args.</param>
        /// <returns>A bool value.</returns>
        private bool OnMouseWheel(double delta, HtmlEventArgs e)
        {
            Point mousePosition = new Point(e.OffsetX, e.OffsetY);

            // in Firefox offsetX/screenX is not set and pageX is giving wacky numbers.
            if (HtmlPage.BrowserInformation.Name == "Netscape")
            {
                mousePosition = MouseWheelGenerator.mousePosition;

                HtmlElement offsetElement = HtmlPage.Plugin;
                while (offsetElement != null && offsetElement != HtmlPage.Document.Body)
                {
                    mousePosition.X -= (double)offsetElement.GetProperty("offsetLeft");
                    mousePosition.Y -= (double)offsetElement.GetProperty("offsetTop");

                    offsetElement = offsetElement.Parent;
                }
            }

            UIElement rootVisual = (UIElement)Application.Current.RootVisual;

            UIElement firstElement = null;
            foreach (UIElement element in VisualTreeHelper.FindElementsInHostCoordinates(mousePosition, rootVisual))
            {
                firstElement = element;
                break;
            }

            if (firstElement != null)
            {
                FrameworkElement source = (FrameworkElement)firstElement;

                MouseWheelEventArgs wheelArgs = new MouseWheelEventArgs(source, delta, mousePosition);
                MouseWheelGenerator.MouseWheelEvent.RaiseEvent(wheelArgs);

                return wheelArgs.Handled;
            }

            return false;
        }
Exemple #50
0
 void textArea_MouseWheel(object sender, MouseWheelEventArgs e)
 {
     e.Handled = RaiseEventPair(GetScrollEventTarget(),
                                PreviewMouseWheelEvent, MouseWheelEvent,
                                new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta));
 }
Exemple #51
0
 internal void MouseWheel(BIT.AVL.Silver.Map.Map map, MouseWheelEventArgs args)
 {
     if(EnableMouseWheel)
     {
         if(MapMouseWheel != null) MapMouseWheel(map, args);
     }
 }
        private void OnMouseWheel(object sender, MouseWheelEventArgs eventArgs)
        {
            if (eventArgs.Handled || !IsEnabled)
            {
                return;
            }

            var cameraNode = CameraNode;

            if (cameraNode == null)
            {
                return;
            }

            float modifier = 1;

            if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
            {
                modifier *= 10;
            }
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
            {
                modifier /= 10;
            }

            float increments     = (float)eventArgs.Delta / Mouse.MouseWheelDeltaForOneLine;
            float distanceChange = (float)Speed * increments * modifier;

            // Move camera in forward direction.
            Pose    pose    = cameraNode.PoseWorld;
            Vector3 forward = pose.ToWorldDirection(Vector3.Forward);

            pose.Position += forward * distanceChange;

            // Apply min/max distance limits.
            if (Numeric.IsFinite(MinDistance) || Numeric.IsFinite(MaxDistance))
            {
                var   cameraToTarget = CameraTarget - pose.Position;
                float cameraDistance = cameraToTarget.Length;

                // cameraDistance is negative if the target is behind the camera.
                if (Vector3.Dot(cameraToTarget, forward) < 0)
                {
                    cameraDistance = -cameraDistance;
                }

                // Normally, cameraToTarget should be equal to forward and the min/max
                // limits should only be used with an orbiting camera. However, if the user
                // makes strange use of the distance limits, it is safer to use
                // cameraToTarget (and only fall back to forward if necessary).
                if (!cameraToTarget.TryNormalize())
                {
                    cameraToTarget = forward;
                }

                // Following conditions are safe to use with NaN.
                if (cameraDistance < MinDistance)
                {
                    cameraDistance = (float)MinDistance;
                }
                if (cameraDistance > MaxDistance)
                {
                    cameraDistance = (float)MaxDistance;
                }

                pose.Position = CameraTarget - cameraToTarget * cameraDistance;
            }

            cameraNode.PoseWorld = pose;
            eventArgs.Handled    = true;
        }
 public override void OnMouseWheelChanged(Game game_, MouseWheelEventArgs args)
 {
     if (IsMouseOverCells() && game.guistate == GuiState.Inventory)
     {
         float delta = args.GetDeltaPrecise();
         if (delta > 0)
         {
             ScrollUp();
         }
         if (delta < 0)
         {
             ScrollDown();
         }
     }
 }
 protected override void OnMouseWheel(MouseWheelEventArgs e)
 {
 }
Exemple #55
0
 public void HandleMouseWheel(MouseWheelEventArgs e)
 {
     z += e.GetDeltaPrecise() / 5;
     screen.OnMouseWheel(e);
 }
Exemple #56
0
 private void InkCanvas_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
 {
     textBox.Text += "InkCanvas_PreviewMouseWheel\n";
 }
Exemple #57
0
 internal void MouseWheel(Map map, MouseWheelEventArgs args)
 {
     if (EnableMouseWheel)
     {
         if (MapMouseWheel != null) MapMouseWheel(map, args);
     }
 }
Exemple #58
0
		void Mouse_WheelChanged(object sender, MouseWheelEventArgs e)
		{
			if (_hoverWidget == null) {
				MouseWheelChanged.Raise (this, e);
				return;
			}
			_hoverWidget.onMouseWheel (this, e);
		}        
 private void HandleMouseWheel(object sender, MouseWheelEventArgs args)
 {
     if (this.isMouseOver)
             this.Moved(this, args);
 }
Exemple #60
0
 public void PreprocessMouseWheel(MouseWheelEventArgs e)
 {
 }