Exemple #1
0
		private void MapHud_ClientMouseLeave(object sender, HudMouseEventArgs e)
		{
			ActiveHotspot = Hotspot.None;
		}
Exemple #2
0
		private void MapHud_ClientMouseWheel(object sender, HudMouseEventArgs e)
		{
			float origZoom = ActualZoom;
			ZoomFactor += e.Delta / (double)HudMouseEventArgs.WHEEL_DELTA;

			if (CenterOnPlayer && IsCenteredOnPlayer(origZoom, ClientSize))
			{
				mNeedsPlayerRecenter = true;
			}
			else
			{
				PointF centerOn;

				if (!e.Control && !e.Shift)
				{
					// Keep point under mouse cursor in same spot
					centerOn = e.Location;
				}
				else
				{
					// Keep center in same spot
					centerOn = new PointF(ClientSize.Width / 2.0f, ClientSize.Height / 2.0f);
				}

				mOffset.X += centerOn.X * (1 / ActualZoom - 1 / origZoom);
				mOffset.Y += centerOn.Y * (1 / ActualZoom - 1 / origZoom);
			}

			RepaintAll();
			e.Eat = true;
		}
Exemple #3
0
		private void MapHud_ClientMouseMove(object sender, HudMouseEventArgs e)
		{
			CalcActiveHotspot(e.Location);
		}
Exemple #4
0
		private void MapHud_ClientMouseUp(object sender, HudMouseEventArgs e)
		{
			if (((ClientMouseButtons & ~e.Button) & DragButton) == 0 && mIsDragging)
			{
				mIsDragging = false;
				RepaintAll();
			}

			if (mClickedHotspotRect.Contains(e.Location))
			{
				if ((e.Button & SelectLocationButton) != 0)
				{
					if (e.Control)
					{
						mPluginCore.SetRouteEnd(ActiveHotspot.loc);
					}
					else if (e.Shift)
					{
						mPluginCore.SetRouteStart(ActiveHotspot.loc);
					}
					else
					{
						mPluginCore.mArrowHud.DestinationLocation = ActiveHotspot.loc;
						mPluginCore.mArrowHud.Visible = true;
					}
				}
				else if ((e.Button & ContextMenuButton) != 0)
				{
					ShowContextMenu(ActiveHotspot.loc);
				}
				else if ((e.Button & DetailsButton) != 0)
				{
					mPluginCore.ShowDetails(ActiveHotspot.loc);
				}
			}
			else if (ActiveHotspot == Hotspot.None && (e.Button & ContextMenuButton) != 0)
			{
				ShowContextMenu(PixToCoords(e.Location, ActualZoom));
			}
			mClickedHotspotRect = Rectangle.Empty;
		}
Exemple #5
0
		private void MapHud_ClientMouseDoubleClick(object sender, HudMouseEventArgs e)
		{
			if ((e.Button & DragButton) != 0)
			{
				CenterOnPix(e.Location, Zoom);
				RepaintAll();
				e.Eat = true;
			}
		}
Exemple #6
0
		private void MapHud_ClientMouseDown(object sender, HudMouseEventArgs e)
		{
			if ((e.Button & DragButton) != 0)
			{
				mMouseDownOffset.X = (e.Location.X - mOffset.X * Zoom) / Zoom;
				mMouseDownOffset.Y = (e.Location.Y - mOffset.Y * Zoom) / Zoom;
				mIsDragging = true;
				e.Eat = true;
			}

			if ((e.Button & (SelectLocationButton | ContextMenuButton | DetailsButton)) != 0
					&& ActiveHotspot != Hotspot.None && ActiveHotspot.rect.Contains(e.Location))
			{
				mClickedHotspotRect = ActiveHotspot.rect;
				e.Eat = true;
			}
		}
Exemple #7
0
		public bool Matches(HudMouseEventArgs e)
		{
			return ((mButtons & e.Button) != 0) && ((e.ModifierKeys & mModifierKeys) == mModifierKeys);
		}
Exemple #8
0
		private void MouseEvent(EventHandler<HudMouseEventArgs> EventToFire, WindowMessageEventArgs e,
				MouseButtons button, int clicks, int x, int y, int delta, short fwKeys, bool allowEat)
		{
			if (EventToFire != null)
			{
				HudMouseEventArgs args = new HudMouseEventArgs(button, clicks, x, y, delta, fwKeys);
				EventToFire(this, args);
				if (allowEat && args.Eat)
					e.Eat = true;
			}
		}
Exemple #9
0
		// Handles the MouseLeave event
		private void FadeOut(object sender, HudMouseEventArgs e)
		{
			if (!Sticky)
			{
				FadeAlpha(AlphaFrameInactive, 500, 0);
			}
		}
Exemple #10
0
		// Handles the MouseEnter event
		private void FadeIn(object sender, HudMouseEventArgs e)
		{
			FadeAlpha(AlphaFrameActive, 300, 0);
		}