protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); Vector2 mousePosition = GetPositionInScene(new Vector2(e.Location)); if (e.Button == MouseButtons.Left) { // unselect all items foreach (ObsSceneItem item in scene.Items) { item.Selected = false; } // select item under the mouse cursor using (ObsSceneItem mouseItem = GetItemAtPosition(mousePosition)) { if (mouseItem != null && !dragging) { Vector2 pixel = new Vector2(1.0f / mouseItem.Bounds.x, 1.0f / mouseItem.Bounds.y); Vector3 transformedPos = Vector3.GetTransform( new Vector3(mousePosition), mouseItem.BoxTransform.GetInverse()); Obs.Log(LogErrorLevel.Info, pixel.ToString()); //TODO: test dragging near edges dragging = true; dragLastPosition = mousePosition; mouseItem.Selected = true; if (mouseItem == hoveredItem) { SetHoveredItem(null); } } } } }