private void HandleMagicWandClick(InputLibrary.Cursor cursor) { int minX; int minY; int maxX; int maxY; var camera = imageRegionSelectionControl1.SystemManagers.Renderer.Camera; float worldX; float worldY; camera.ScreenToWorld(cursor.X, cursor.Y, out worldX, out worldY);; InspectableTexture.GetOpaqueWandBounds((int)worldX, (int)worldY, out minX, out minY, out maxX, out maxY); bool hasValidSelection = minX > 0 && maxX > 0; if (hasValidSelection) { var texture = imageRegionSelectionControl1.CurrentTexture; SetSelectionTextureCoordinates(minY, maxY, minX, maxX); EndRegionChanged?.Invoke(); } }
private void KeyboardActivity(Keyboard keyBoard) { if (this.Visible) { bool changed = false; // don't do this if CTRL is held - that's reserved for camera movement bool isCtrlHeld = keyBoard.KeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) || keyBoard.KeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl); if (!isCtrlHeld) { if (keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Left) || keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Right) || keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Up) || keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Down)) { // record before any changes are made RecordOldValues(); StartRegionChanged?.Invoke(this, null); } if (keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Left)) { this.Left--; // Width should take care of this //this.Right--; changed = true; } if (keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Right)) { this.Left++; // Width should take care of this //this.Right--; changed = true; } if (keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Up)) { this.Top--; changed = true; } if (keyBoard.KeyPushed(Microsoft.Xna.Framework.Input.Keys.Down)) { this.Top++; changed = true; } if (changed) { RegionChanged?.Invoke(this, null); EndRegionChanged?.Invoke(this, null); } } } }
private void ClickActivity(Cursor cursor) { if (cursor.PrimaryClick) { mSideGrabbed = ResizeSide.None; this.Left = RoundIfNecessary(this.Left); this.Top = RoundIfNecessary(this.Top); this.Width = RoundIfNecessary(this.Width); this.Height = RoundIfNecessary(this.Height); if (shouldRaiseEndRegionChanged) { EndRegionChanged?.Invoke(this, null); shouldRaiseEndRegionChanged = false; } UpdateHandles(); } }
private void HandleEndRegionChanged(object sender, EventArgs e) { EndRegionChanged?.Invoke(); }
void EndRegionChangedInternal(object sender, EventArgs e) { EndRegionChanged?.Invoke(this, null); }