private void viewPane_MouseUp(object sender, PointerRoutedEventArgs e) { Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint((UIElement)(sender)); CalcPoint mousePos = new CalcPoint(ptrPt.Position); MouseButton mB = MouseButton.NONE; MouseObject mousePoint; if (leftpointer != null) { if (leftpointer.PointerId.Equals(e.Pointer.PointerId)) { leftpointer = null; mB = MouseButton.LEFT; } } if (rightpointer != null) { if (rightpointer.PointerId.Equals(e.Pointer.PointerId)) { rightpointer = null; mB = MouseButton.RIGHT; } } mousePoint = new MouseObject(mB, mousePos); mouse.viewPane_Released(mousePoint); }
private void viewPane_MouseDown(object sender, PointerRoutedEventArgs e) { Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint((UIElement)(sender)); CalcPoint mousePos = new CalcPoint(ptrPt.Position); MouseButton mB = MouseButton.NONE; MouseObject mousePoint; //status2 += "Mouse Down" + "\n"; if (ptrPt.Properties.IsRightButtonPressed) { rightpointer = e.Pointer; mB = MouseButton.RIGHT; } if (ptrPt.Properties.IsLeftButtonPressed) { leftpointer = e.Pointer; mB = MouseButton.LEFT; } if (ptrPt.Properties.IsMiddleButtonPressed) { leftpointer = e.Pointer; mB = MouseButton.MIDDLE; } mousePoint = new MouseObject(mB, mousePos); mouse.viewPane_Pressed(mousePoint); }
public void viewPane_Released(MouseObject mousObj) { CalcPoint mousePos = mousObj.currentMousePos; if (GlobalNodeHandler.TabletSelected) { if (GlobalNodeHandler.adding && tickcnt - clickstartcount < 10) { if (GlobalNodeHandler.clickedNode == null && GlobalNodeHandler.clickedLabel == null) { if (GlobalNodeHandler.CreateNewNode(mousePos.X, mousePos.Y, true)) { CalcPoint CreatePoint; CreatePoint = new CalcPoint(mousePos.X - GlobalNodeHandler.clickedNode.width, mousePos.Y - GlobalNodeHandler.clickedNode.height); GlobalNodeHandler.ShowTextBox(CreatePoint, activetext); repaint(this, new EventArgs()); } } } if (dragging) { dragging = false; int x = mousePos.X; int y = mousePos.Y; if (selectedGroup.Count != 0) { diffPoints = new List <CalcPoint>(); } else if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.SetPosition(mousePos.X, mousePos.Y, true); GlobalNodeHandler.clickedNode.setHovered(false); GlobalNodeHandler.clickedNode = null; repaint(this, new EventArgs()); } } if (transformPoint.X != 0 || transformPoint.Y != 0) { transformPoint = new CalcPoint(); transformnode.SetScaled(true); transformnode.UpdatePivots(); transformnode.UpdateTransformRec(); transformnode.updateRepresentation(); repaint(this, new EventArgs()); transformnode = null; } if (dragView) { dragView = false; repaint(this, new EventArgs()); } } else if (GlobalNodeHandler.mouseSelected) { viewPane_MouseUp(mousObj); } }
public async void viewPane_Pressed(MouseObject mousObj) { CalcPoint mousePos = mousObj.currentMousePos; if (GlobalNodeHandler.TabletSelected) { if (!GlobalNodeHandler.typing) { if (GlobalNodeHandler.pick1.BoxContains(mousePos.ToPoint())) { if (GlobalNodeHandler.pick1.ChangeColorTo(mousePos.ToPoint())) { repaint(this, new EventArgs()); } } else { if (GlobalNodeHandler.transforming) { if ((transformnode = GlobalNodeHandler.viewNode.ContainsTRecChild(mousePos.X, mousePos.Y)) != null) { MindNodeAction action = new MindNodeAction(6, "Transform", transformnode); transformStart = mousePos; startWidth = transformnode.width; startHeight = transformnode.height; action.sourceSize.X = startWidth; action.sourceSize.Y = startHeight; action.startpoint.Push(new CalcPoint(transformnode.xpos, transformnode.ypos)); dragView = false; NodeStart = new CalcPoint(transformnode.xpos, transformnode.ypos); if (mousePos.X < transformnode.xpos + transformInBorder) { transformPoint.X = -1; } else if (mousePos.X > transformnode.xpos + transformnode.width - transformInBorder) { transformPoint.X = 1; } if (mousePos.Y < transformnode.ypos + transformInBorder) { transformPoint.Y = -1; } else if (mousePos.Y > transformnode.ypos + transformnode.height - transformInBorder) { transformPoint.Y = 1; } GlobalNodeHandler.actionLog.AddAction(action); } } if (GlobalNodeHandler.connecting) { if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.setSelected(false); } } if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(mousePos.X, mousePos.Y)) == null) { GlobalNodeHandler.clickedLabel = GlobalNodeHandler.viewNode.ContainsChildLabel(mousePos.X, mousePos.Y); GlobalNodeHandler.rightNode = null; mouseStartPoint = mousePos; if (transformnode == null) { dragView = true; } clickstartcount = tickcnt; if (GlobalNodeHandler.coloring) { if (GlobalNodeHandler.clickedLabel != null) { GlobalNodeHandler.clickedLabel.NodeColor = ColorPicker.selectedcolor; GlobalNodeHandler.clickedLabel.updateRepresentation(); repaint(this, new EventArgs());; } } if (GlobalNodeHandler.paste) { await GlobalNodeHandler.settings.RestoreFromClipboard(mousePos.X, mousePos.Y); } } else { if (mousObj.thisButton.Equals(MouseButton.LEFT)) { if (GlobalNodeHandler.coloring) { if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.NodeColor = ColorPicker.selectedcolor; GlobalNodeHandler.clickedNode.updateRepresentation(); repaint(this, new EventArgs());; } } if (GlobalNodeHandler.jumping) { GlobalNodeHandler.JumpInto(GlobalNodeHandler.clickedNode); repaint(this, new EventArgs()); } if (GlobalNodeHandler.copy) { GlobalNodeHandler.settings.CopyToClipboard(GlobalNodeHandler.clickedNode); } else if (GlobalNodeHandler.cut) { GlobalNodeHandler.settings.CopyToClipboard(GlobalNodeHandler.clickedNode); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(1, "DeleteNode", GlobalNodeHandler.clickedNode)); GlobalNodeHandler.clickedNode.DeleteAllConnections(); GlobalNodeHandler.clickedNode.DeleteNode(); repaint(this, new EventArgs()); } else if (GlobalNodeHandler.connecting) { if (GlobalNodeHandler.rightNode == null) { GlobalNodeHandler.rightNode = GlobalNodeHandler.clickedNode; GlobalNodeHandler.rightNode.setSelected(true); } else if (!GlobalNodeHandler.clickedNode.Equals(GlobalNodeHandler.rightNode)) { GlobalNodeHandler.rightNode.setSelected(false); if (GlobalNodeHandler.rightNode.AddConnection(GlobalNodeHandler.clickedNode)) { GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(3, "ConnectNodes", GlobalNodeHandler.rightNode, GlobalNodeHandler.clickedNode)); } GlobalNodeHandler.rightNode.UpdateBridgesRepresentation(); GlobalNodeHandler.clickedNode = null; GlobalNodeHandler.rightNode = null; } repaint(this, new EventArgs()); } else if (GlobalNodeHandler.disconnecting) { if (GlobalNodeHandler.rightNode == null) { GlobalNodeHandler.rightNode = GlobalNodeHandler.clickedNode; GlobalNodeHandler.rightNode.setSelected(true); } else { GlobalNodeHandler.rightNode.setSelected(false); if (GlobalNodeHandler.rightNode.connNodes.Contains(GlobalNodeHandler.clickedNode)) { GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(4, "DeleteConnections", GlobalNodeHandler.rightNode, GlobalNodeHandler.clickedNode)); } else { GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(4, "DeleteConnections", GlobalNodeHandler.clickedNode, GlobalNodeHandler.rightNode)); } GlobalNodeHandler.rightNode.DeleteConnection(GlobalNodeHandler.clickedNode); GlobalNodeHandler.clickedNode.DeleteConnection(GlobalNodeHandler.rightNode); GlobalNodeHandler.clickedNode = null; GlobalNodeHandler.rightNode = null; } repaint(this, new EventArgs()); } else if (GlobalNodeHandler.deleting) { MindNodeAction action = new MindNodeAction(3, "DeleteConnections"); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); foreach (MindNode m in GlobalNodeHandler.clickedNode.connNodes) { action.involvedNodes.Push(GlobalNodeHandler.clickedNode); action.involvedNodes.Push(m); } foreach (MindNode m in GlobalNodeHandler.clickedNode.backconnNodes) { action.involvedNodes.Push(m); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); } GlobalNodeHandler.actionLog.AddAction(action); GlobalNodeHandler.clickedNode.DeleteAllConnections(); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(1, "DeleteNode", GlobalNodeHandler.clickedNode)); GlobalNodeHandler.viewNode.DeleteNode(GlobalNodeHandler.clickedNode); repaint(this, new EventArgs()); } else if (GlobalNodeHandler.moving) { if (selectedGroup.Count != 0) { MindNodeAction moveaction = new MindNodeAction(2, "MoveNodes"); foreach (MindNode m in selectedGroup) { diffPoints.Add(new CalcPoint(m.xpos - GlobalNodeHandler.clickedNode.xpos, m.ypos - GlobalNodeHandler.clickedNode.ypos)); moveaction.startpoint.Push(new CalcPoint(m.xpos, m.ypos)); moveaction.involvedNodes.Push(m); } GlobalNodeHandler.actionLog.AddAction(moveaction); } else { MindNodeAction moveaction = new MindNodeAction(2, "MoveNodes", GlobalNodeHandler.clickedNode); moveaction.startpoint.Push(new CalcPoint(GlobalNodeHandler.clickedNode.xpos, GlobalNodeHandler.clickedNode.ypos)); GlobalNodeHandler.actionLog.AddAction(moveaction); } dragging = true; } } } if (GlobalNodeHandler.placelabel) { if (GlobalNodeHandler.clickedNode != null) { activetext.Text = GlobalNodeHandler.clickedNode.text; GlobalNodeHandler.ShowTextBox(mousObj.currentMousePos, activetext); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedNode, GlobalNodeHandler.clickedNode.text)); GlobalNodeHandler.typing = true; } else if (GlobalNodeHandler.clickedLabel != null) { activetext.Text = GlobalNodeHandler.clickedLabel.GetText(); GlobalNodeHandler.ShowTextBox(mousObj.currentMousePos, activetext); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedLabel, GlobalNodeHandler.clickedLabel.GetText())); GlobalNodeHandler.typing = true; } } } } } else if (GlobalNodeHandler.mouseSelected) { viewPane_MouseDown(mousObj); } }
public void viewPane_MouseUp(MouseObject mousObj) { CalcPoint mousePos = mousObj.currentMousePos; //MainPage.status2 += "Released"+"" + ptrPt.Properties.IsRightButtonPressed.ToString(); if (mousObj.thisButton.Equals(MouseButton.LEFT)) { if (tickcnt - clickstartcount < 10 && !surpressMouseup) { surpressMouseup = false; //System.out.println("mouseclick"); if (!GlobalNodeHandler.typing) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(mousePos.X, mousePos.Y)) == null) { if (!dragView) { if ((GlobalNodeHandler.clickedLabel = GlobalNodeHandler.viewNode.ContainsChildLabel(mousePos.X, mousePos.Y)) != null) { activetext.Visibility = Visibility.Visible; activetext.Margin = new Thickness(currentFormPosition.X, currentFormPosition.Y, 0, 0); activetext.Text = GlobalNodeHandler.clickedLabel.GetText(); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedLabel, GlobalNodeHandler.clickedLabel.GetText())); GlobalNodeHandler.typing = true; } else { if (GlobalNodeHandler.CreateNewNode(mousePos.X, mousePos.Y, true)) { CalcPoint CreatePoint = new CalcPoint(); if (currentFormPosition != null) { CreatePoint = new CalcPoint(currentFormPosition.X - GlobalNodeHandler.clickedNode.width, currentFormPosition.Y - GlobalNodeHandler.clickedNode.height); } GlobalNodeHandler.ShowTextBox(CreatePoint, activetext); repaint(this, new EventArgs()); } } } } else { activetext.Visibility = Visibility.Visible; activetext.Margin = new Thickness(currentFormPosition.X, currentFormPosition.Y, 0, 0); activetext.Text = GlobalNodeHandler.clickedNode.text; GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedNode, GlobalNodeHandler.clickedNode.text)); GlobalNodeHandler.typing = true; } } if (dragRec) { mouseEndPoint = mousePos; dragRec = false; selectedGroup = GlobalNodeHandler.viewNode.ChildrenInRec(selectionRec); foreach (MindNode m in selectedGroup) { m.setHovered(true); } selectionRec = new Rect(0, 0, 0, 0); repaint(this, new EventArgs()); } else if (dragView) { dragView = false; repaint(this, new EventArgs()); } } } if (mousObj.thisButton.Equals(MouseButton.RIGHT)) { if (transformrecx != 0 || transformrecy != 0) { if (transformrecx != 0) { transformrecx = 0; } if (transformrecy != 0) { transformrecy = 0; } GlobalNodeHandler.clickedNode.SetScaled(true); GlobalNodeHandler.clickedNode.updateRepresentation(); repaint(this, new EventArgs()); } if (dragging) { dragging = false; int x = mousePos.X; int y = mousePos.Y; if (selectedGroup.Count != 0) { diffPoints = new List <CalcPoint>(); } else if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.SetPosition(x, y, true); GlobalNodeHandler.clickedNode.setHovered(false); GlobalNodeHandler.clickedNode = null; repaint(this, new EventArgs()); } } else if (dragView) { dragView = false; repaint(this, new EventArgs()); } } }
public void viewPane_MouseDown(MouseObject mousObj) { CalcPoint mousePos = mousObj.currentMousePos; if (GlobalNodeHandler.pick1.BoxContains(mousePos.ToPoint()) && GlobalNodeHandler.pick1.isVisible) { if (GlobalNodeHandler.pick1.ChangeColorTo(mousePos.ToPoint())) { if (GlobalNodeHandler.typing) { if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.TextColor = ColorPicker.selectedcolor; } if (GlobalNodeHandler.clickedLabel != null) { GlobalNodeHandler.clickedLabel.TextColor = ColorPicker.selectedcolor; } } repaint(this, new EventArgs()); } } else { if (mousObj.thisButton.Equals(MouseButton.LEFT)) { clickstartcount = tickcnt; if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(mousePos.X, mousePos.Y)) == null) { surpressMouseup = false; if (selectedGroup.Count != 0) { foreach (MindNode m in selectedGroup) { m.setHovered(false); } selectedGroup = new List <MindNode>(); diffPoints = new List <CalcPoint>(); surpressMouseup = true; } mouseStartPoint = mousePos; dragRec = true; } } if (mousObj.thisButton.Equals(MouseButton.MIDDLE)) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(mousePos.X, mousePos.Y)) != null) { MainPage.status2 += "Middle Chosen" + "\n"; GlobalNodeHandler.clickedNode.NodeColor = ColorPicker.selectedcolor; GlobalNodeHandler.clickedNode.updateRepresentation(); repaint(this, new EventArgs());; } else if ((GlobalNodeHandler.clickedLabel = GlobalNodeHandler.viewNode.ContainsChildLabel(mousePos.X, mousePos.Y)) != null) { GlobalNodeHandler.clickedLabel.NodeColor = ColorPicker.selectedcolor; GlobalNodeHandler.clickedLabel.updateRepresentation(); repaint(this, new EventArgs());; } } if (mousObj.thisButton.Equals(MouseButton.RIGHT)) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(mousePos.X, mousePos.Y)) != null) { MainPage.status2 += "IsRight CLicked" + "\n"; MindNodeAction action = new MindNodeAction(GlobalNodeHandler.clickedNode); if (mousePos.X < GlobalNodeHandler.clickedNode.xpos + 5) { transformrecx = -1; transformStart = mousePos; startWidth = GlobalNodeHandler.clickedNode.width; NodeStart = new CalcPoint(GlobalNodeHandler.clickedNode.xpos, GlobalNodeHandler.clickedNode.ypos); action.sourceSize.X = startWidth; action.id = 6; action.name = "Transform"; GlobalNodeHandler.actionLog.AddAction(action); } else if (mousePos.X > GlobalNodeHandler.clickedNode.xpos + GlobalNodeHandler.clickedNode.width - 5) { transformrecx = 1; transformStart = mousePos; startWidth = GlobalNodeHandler.clickedNode.width; NodeStart = new CalcPoint(GlobalNodeHandler.clickedNode.xpos, GlobalNodeHandler.clickedNode.ypos); action.sourceSize.X = startWidth; action.id = 6; action.name = "Transform"; GlobalNodeHandler.actionLog.AddAction(action); } else if (mousePos.Y < GlobalNodeHandler.clickedNode.ypos + 5) { transformrecy = -1; transformStart = mousePos; startHeight = GlobalNodeHandler.clickedNode.height; NodeStart = new CalcPoint(GlobalNodeHandler.clickedNode.xpos, GlobalNodeHandler.clickedNode.ypos); action.sourceSize.Y = startHeight; action.id = 6; action.name = "Transform"; GlobalNodeHandler.actionLog.AddAction(action); } else if (mousePos.Y > GlobalNodeHandler.clickedNode.ypos + GlobalNodeHandler.clickedNode.height - 5) { transformrecy = 1; transformStart = mousePos; startHeight = GlobalNodeHandler.clickedNode.height; NodeStart = new CalcPoint(GlobalNodeHandler.clickedNode.xpos, GlobalNodeHandler.clickedNode.ypos); action.sourceSize.Y = startHeight; action.id = 6; action.name = "Transform"; GlobalNodeHandler.actionLog.AddAction(action); } else { if (GlobalNodeHandler.clickedNode.getSelected()) { GlobalNodeHandler.clickedNode.setHovered(false); } if (selectedGroup.Count != 0) { MindNodeAction moveaction = new MindNodeAction(2, "MoveNodes"); foreach (MindNode m in selectedGroup) { diffPoints.Add(new CalcPoint(m.xpos - GlobalNodeHandler.clickedNode.xpos, m.ypos - GlobalNodeHandler.clickedNode.ypos)); moveaction.startpoint.Push(new CalcPoint(m.xpos, m.ypos)); moveaction.involvedNodes.Push(m); } GlobalNodeHandler.actionLog.AddAction(moveaction); } else { MindNodeAction moveaction = new MindNodeAction(2, "MoveNodes", GlobalNodeHandler.clickedNode); moveaction.startpoint.Push(new CalcPoint(GlobalNodeHandler.clickedNode.xpos, GlobalNodeHandler.clickedNode.ypos)); GlobalNodeHandler.actionLog.AddAction(moveaction); } dragging = true; } } else { mouseStartPoint = mousePos; dragView = true; } } } }