private void RegexDataChanged(object sender, DigitalRune.Windows.TextEditor.Document.DocumentEventArgs e) { this.RegexDataChanged(); }
protected override void OnHandleInput(DigitalRune.Game.UI.Controls.InputContext context) { //onlyhandle input if not other control has handled it. if (!InputService.IsMouseOrTouchHandled && IsMouseDirectlyOver) { Vector2 TransformedMousePos = Vector2.Transform(new Vector2(context.MousePosition.X - ActualX, context.MousePosition.Y - ActualY), Matrix.Invert(_gameManager.GalaxyCam.getTransformation() * _gameManager.GalaxyCam.getScale())); Vector2 TransformedMouseDeltaPos = Vector2.Transform(new Vector2((context.MousePosition.X - context.MousePositionDelta.X) - ActualX, (context.MousePosition.Y - context.MousePositionDelta.Y) - ActualY), Matrix.Invert(_gameManager.GalaxyCam.getTransformation() * _gameManager.GalaxyCam.getScale())); _mousePos = TransformedMousePos; _mousePosMoved = TransformedMouseDeltaPos; var _mousePosMovedDelta = TransformedMousePos - TransformedMouseDeltaPos; //Here we can handle all checks against world coordinates. if (InputService.MouseWheelDelta != 0) { //_gameManager.GalaxyCam.Pos = TransformedMousePos; _gameManager.GalaxyCam.Zoom += InputService.MouseWheelDelta > 1 ? 0.04f : -0.04f; InputService.IsMouseOrTouchHandled = true; } if (InputService.IsDown(MouseButtons.Left)) { if (_gameManager.GalaxyCam.Move(-_mousePosMovedDelta)) { scrollX += context.MousePositionDelta.X; scrollY += context.MousePositionDelta.Y; InputService.IsMouseOrTouchHandled = true; } } if (InputService.IsDoubleClick(MouseButtons.Left)) { foreach (Model.GalaxySector sec in _gameManager.Galaxy.Sectors) { foreach (Model.Star star in sec.Stars) { if (star.BoundingBox.Intersects(new Rectangle((int)TransformedMousePos.X, (int)TransformedMousePos.Y, 1, 1))) { //teststring = "double Clicked Star"; break; } else { //teststring = "empty"; } } InputService.IsMouseOrTouchHandled = true; return; } } IsClicked = false; if (InputService.IsDown(MouseButtons.Left) && IsMouseOver && IsDown == false) { InputService.IsMouseOrTouchHandled = true; IsClicked = true; } IsDown = InputService.IsDown(MouseButtons.Left); if (IsClicked) { foreach (Model.GalaxySector sec in _gameManager.Galaxy.Sectors) { foreach (Model.Star star in sec.Stars) { if (star.BoundingBox.Intersects(new Rectangle((int)TransformedMousePos.X, (int)TransformedMousePos.Y, 1, 1))) { //teststring = "Clicked Star"; break; } else { //teststring = "empty"; } } } } } base.OnHandleInput(context); }
void TextEditorControl_DocumentChanged(object sender, DigitalRune.Windows.TextEditor.Document.DocumentEventArgs e) { if (this.DocumentChangedIgnoredDuringInitialization) return; if (this.OnTextNotSaved == null) return; this.OnTextNotSaved(this, new ScriptEditorEventArgs(this.ScriptSourceCode)); }