private void OnMouseMove(object seneder, MouseEventArgs e) { if (!_settingPosition) { _settingPosition = true; FrameworkElement associatedObject = AssociatedObject; Vector delta = e.GetPosition(associatedObject) - _relativePosition; ManipulationModes supportedGestures = SupportedGestures; if ((supportedGestures & ManipulationModes.TranslateX) == 0) { delta.X = 0.0f; } if ((supportedGestures & ManipulationModes.TranslateY) == 0) { delta.Y = 0.0f; } _translate.X += delta.X; _translate.Y += delta.Y; _settingPosition = false; } }
private void C1TouchEventProvider1_ManipulationStarting(object sender, C1.Win.TouchToolKit.ManipulationStartingEventArgs e) { Point pointerPosition = e.Position; bool hitTest = this.paintPanel1.HitTest(pointerPosition); if (this.TouchMode == MyTouchMode.Default) { if (hitTest) { e.Mode = ManipulationModes.All; } else { e.Mode = ManipulationModes.Rotate | ManipulationModes.RotateInertia; } } else { if (this.paintPanel1.ActiveImageIndex != -1) { ManipulationPivot pivot = new ManipulationPivot(); pivot.Center = this.paintPanel1.GetImageCenter(this.paintPanel1.ActiveImageIndex); pivot.Radius = this.paintPanel1.GetImageRadius(this.paintPanel1.ActiveImageIndex); e.Pivot = pivot; } e.Mode = ManipulationModes.Rotate | ManipulationModes.RotateInertia; } manipulationMode = e.Mode; if (e.Mode == ManipulationModes.All) { e.Handled = true; } }
private static Manipulations2D ConvertMode(ManipulationModes mode) { Manipulations2D manipulations = Manipulations2D.None; if ((mode & ManipulationModes.TranslateX) != 0) { manipulations |= Manipulations2D.TranslateX; } if ((mode & ManipulationModes.TranslateY) != 0) { manipulations |= Manipulations2D.TranslateY; } if ((mode & ManipulationModes.Scale) != 0) { manipulations |= Manipulations2D.Scale; } if ((mode & ManipulationModes.Rotate) != 0) { manipulations |= Manipulations2D.Rotate; } return(manipulations); }
void UpdateManipulationMode() { ManipulationModes modes = (_element.ManipulationMode == (ManipulationModes.None | ManipulationModes.System)) ? ManipulationModes.None : _element.ManipulationMode; if (_mode.TranslateRailX()) { modes |= ManipulationModes.None | ManipulationModes.TranslateRailsX | ManipulationModes.TranslateX; } if (_mode.TranslateRailY()) { modes |= ManipulationModes.None | ManipulationModes.TranslateRailsY | ManipulationModes.TranslateY; } if (_mode.TranslateX()) { modes |= ManipulationModes.None | ManipulationModes.TranslateX; } if (_mode.TranslateY()) { modes |= ManipulationModes.None | ManipulationModes.TranslateY; } if (_mode.IsInertial()) { modes |= ManipulationModes.None | ManipulationModes.TranslateInertia; } _element.ManipulationMode = modes; }
void OnMouseWheel(object sender, MouseWheelEventArgs e) { ManipulationModes supportedGestures = SupportedGestures; if ((supportedGestures & ManipulationModes.Scale) != 0) { float sensitivity = WheelSensitivity; float factor = 1.0f + sensitivity; float prevScale = (float)_scale.ScaleX; float scale = prevScale * (e.Delta > 0 ? factor : 1.0f / factor); FrameworkElement target = AssociatedObject; Size renderSize = target.RenderSize; Vector center = new Vector(renderSize.Width * 0.5f, renderSize.Height * 0.5f); Vector point = (Vector)e.GetPosition(target); Vector pointScaled = center + (point - center) * scale; _scale.ScaleX = 1.0f; _scale.ScaleY = 1.0f; _translate.X = 0.0f; _translate.Y = 0.0f; point = (Vector)e.GetPosition(target); Vector offset = point - pointScaled; _scale.ScaleX = scale; _scale.ScaleY = scale; _translate.X = offset.X; _translate.Y = offset.Y; e.Handled = true; } }
private void SetModeHelper(ManipulationModes mode) { NoesisGUI_PINVOKE.ManipulationStartingEventArgs_SetModeHelper(swigCPtr, (int)mode); if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) { throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve(); } }
//Point m_ptTranslate = new Point(); // total translate #endregion #region public MainWindow public MainWindow() { InitializeComponent(); currentMode = ManipulationModes.Scale | ManipulationModes.Translate; m_SP = new System.Media.SoundPlayer(MapProject.Properties.Resources.water_bubble_high); //this.MouseMove += new MouseEventHandler(MyPage_MouseMove); }
private ManipulationModes GetModeHelper() { ManipulationModes ret = (ManipulationModes)NoesisGUI_PINVOKE.ManipulationStartingEventArgs_GetModeHelper(swigCPtr); if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) { throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
private void SetModeHelper(ManipulationModes mode) { NoesisGUI_PINVOKE.ManipulationStartingEventArgs_SetModeHelper(swigCPtr, (int)mode); #if UNITY_EDITOR || NOESIS_API if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) { throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve(); } #endif }
internal ManipulationStartingRoutedEventArgs(UIElement container, ManipulationStartingEventArgs args) : base(container) { Container = container; _args = args; // We should convert back the enum from the args.Settings, but its the same value of the container.ManipulationMode // so we use the easiest path! _mode = container.ManipulationMode; }
public static void LogIfNotSupported(this ManipulationModes mode, ILogger log) { if (!mode.IsSupported() && log.IsEnabled(LogLevel.Information)) { log.Warn( $"The ManipulationMode '{mode}' is not supported by Uno. " + "Only 'None', 'All', 'System', 'TranslateX', 'TranslateY', 'Rotate', and 'Scale' are supported. " + "Using any other mode will not cause an error, but the corresponding manipulation event will not be generated. " + "Note that with Uno the 'All' and 'System' are handled the same way."); } }
public void IncrementManipulationMode() { if ((int)_manipulationMode < System.Enum.GetValues(typeof(ManipulationModes)).Length) { _manipulationMode = _manipulationMode + 1; } else { _manipulationMode = 0; } }
private ManipulationModes GetModeHelper() { ManipulationModes ret = (ManipulationModes)NoesisGUI_PINVOKE.ManipulationStartingEventArgs_GetModeHelper(swigCPtr); #if UNITY_EDITOR || NOESIS_API if (NoesisGUI_PINVOKE.SWIGPendingException.Pending) { throw NoesisGUI_PINVOKE.SWIGPendingException.Retrieve(); } #endif return(ret); }
void ModesDebugMessage(ManipulationModes modes) { string modesString = ""; foreach (ManipulationModes mode in Enum.GetValues(typeof(ManipulationModes))) { if ((mode & modes) != 0) { modesString += "[" + mode + "]"; } } DebugMessage("Modes=" + modesString); }
void ModesDebugMessage(ManipulationModes modes) { var modesString = new StringBuilder(); foreach (ManipulationModes mode in Enum.GetValues(typeof(ManipulationModes))) { if ((mode & modes) != 0) { modesString.Append("[" + mode + "]"); } } DebugMessage("Modes=" + modesString); }
private void LayerDragItemsStarted(ILayer layer, ManipulationModes manipulationModes) { Layerage layerage = LayerManager.FindFirstLayerage(layer); this.DragSourceLayerage = layerage; if (manipulationModes == ManipulationModes.TranslateY) { this.DragLayerIsSelected = true; } else if (manipulationModes == ManipulationModes.System) { this.DragLayerIsSelected = false; } }
private void PrepareParentTouchesManagers(ManipulationModes mode, bool canDrag) { // 1. Make sure to end any pending manipulation ReleaseParentTouchesManager(); // 2. If this control can Walk the tree to detect all ScrollView and register our self as a manipulation listener if (mode != ManipulationModes.System || canDrag) { _parentsTouchesManager = TouchesManager.GetAllParents(this).ToList(); foreach (var manager in _parentsTouchesManager) { manager.RegisterChildListener(); } } }
private void Element_PointerPressed(object sender, PointerRoutedEventArgs e) { this.originalMode = this.element.ManipulationMode; if (this.element.CapturePointer(e.Pointer)) { this.currentPointer = e.Pointer; this.startDragPoint = e.GetCurrentPoint(this.element).Position; this.element.PointerMoved += this.Element_PointerMoved; this.hookedCoreWindow = CoreWindow.GetForCurrentThread(); this.hookedCoreWindow.InputEnabled += this.OnCoreWindowInputEnabled; this.OnPressed(e); } }
public MainWindow() { InitializeComponent(); currentMode = ManipulationModes.Scale | ManipulationModes.Translate; // Build list of radio buttons //foreach (ManipulationModes mode in Enum.GetValues(typeof(ManipulationModes))) //{ // RadioButton radio = new RadioButton // { // Content = mode, // IsChecked = mode == currentMode, // }; // radio.Checked += new RoutedEventHandler(OnRadioChecked); // modeList.Children.Add(radio); //} }
private void GetInput() { if (Input.GetButtonDown("SwitchManipulation")) { switch (manipulationMode) { case ManipulationModes.Pyramid: manipulationMode = ManipulationModes.Mesh; break; case ManipulationModes.Mesh: manipulationMode = ManipulationModes.Pyramid; break; default: manipulationMode = ManipulationModes.Pyramid; break; } } strecht = Input.GetAxisRaw("StretchMeshTrigger"); shrink = -1f * Input.GetAxisRaw("ShrinkMeshTrigger"); if (Input.GetButton("StretchMesh")) { strecht = 1f; } if ((Input.GetButton("ShrinkMesh"))) { shrink = -1f; } if (isActive) { force = (shrink + strecht) * displacementSpeed; } else { force = (shrink + strecht) * 0f; } if (isManipulating && (Mathf.Abs(shrink) + Mathf.Abs(strecht) <= 0.3f)) { isManipulating = false; } }
/// <summary> /// Converts the given <see cref="ManipulationModes"/> to a <see cref="GestureSettings"/>. cf. remarks. /// </summary> /// <remarks> /// The returned <see cref="GestureSettings"/> will contains only manipulation related flags /// as defined in <see cref="GestureSettingsHelper.Manipulations"/> /// </remarks> /// <param name="mode">The manipulation mode to convert</param> /// <returns>The gesture settings with the corresponding manipulation flags set.</returns> public static GestureSettings ToGestureSettings(this ManipulationModes mode) { var settings = default(GestureSettings); if (mode.HasFlag(ManipulationModes.TranslateX)) { settings |= GestureSettings.ManipulationTranslateX; } if (mode.HasFlag(ManipulationModes.TranslateY)) { settings |= GestureSettings.ManipulationTranslateY; } if (mode.HasFlag(ManipulationModes.TranslateRailsX)) { settings |= GestureSettings.ManipulationTranslateRailsX; } if (mode.HasFlag(ManipulationModes.TranslateRailsY)) { settings |= GestureSettings.ManipulationTranslateRailsY; } if (mode.HasFlag(ManipulationModes.TranslateInertia)) { settings |= GestureSettings.ManipulationTranslateInertia; } if (mode.HasFlag(ManipulationModes.Rotate)) { settings |= GestureSettings.ManipulationRotate; } if (mode.HasFlag(ManipulationModes.RotateInertia)) { settings |= GestureSettings.ManipulationRotateInertia; } if (mode.HasFlag(ManipulationModes.Scale)) { settings |= GestureSettings.ManipulationScale; } if (mode.HasFlag(ManipulationModes.ScaleInertia)) { settings |= GestureSettings.ManipulationScaleInertia; } // Note: ManipulationMultipleFingerPanning is not supported by ManipulationModes enumeration return(settings); }
/// <summary> /// Changes the manipulation mode of an active manipulation. /// </summary> /// <param name="element">The element on which there is an active manipulation.</param> /// <param name="mode">The new manipulation mode.</param> public static void SetManipulationMode(UIElement element, ManipulationModes mode) { if (element == null) { throw new ArgumentNullException("element"); } ManipulationDevice device = GetActiveManipulationDevice(element); if (device != null) { device.ManipulationMode = mode; } else { throw new InvalidOperationException(SR.Get(SRID.Manipulation_ManipulationNotActive)); } }
private void MyMap_PointerPressed(object sender, PointerRoutedEventArgs e) { if (MyMap.SpatialReference == null || MyMap.Extent == null) return; if (currentPointerId.HasValue && currentPointerId.Value != e.Pointer.PointerId) return; if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen) { manipulationModeCache = MyMap.ManipulationMode; MyMap.ManipulationMode = ManipulationModes.None; e.Handled = true; currentPointerId = e.Pointer.PointerId; currentGraphic = new Graphic(); currentPolyline = new Polyline() { SpatialReference = MyMap.SpatialReference }; var p = e.GetCurrentPoint(MyMap).Position; currentPolyline.AddPart(new MapPoint[] { MyMap.ScreenToMap(p), MyMap.ScreenToMap(p) }); currentGraphic.Geometry = currentPolyline; MyMap.Layers.OfType<GraphicsLayer>().First().Graphics.Add(currentGraphic); } }
void OnManipulationModeCheckBoxChecked(object sender, RoutedEventArgs args) { // Get composite ManipulationModes value of checked CheckBoxes ManipulationModes manipulationModes = ManipulationModes.None; foreach (UIElement child in checkBoxPanel.Children) { ManipulationModeCheckBox checkBox = child as ManipulationModeCheckBox; if ((bool)checkBox.IsChecked) { manipulationModes |= checkBox.ManipulationModes; } } // Set ManipulationMode property of each Rectangle foreach (UIElement child in rectanglePanel.Children) { child.ManipulationMode = manipulationModes; } }
private void NotifyPointerPressed(PointerRoutedEventArgs e) { this.defaultManipulationMode = this.ManipulationMode; ManipulationModes manipulationMode = ManipulationModes.None; foreach (MapBehavior behavior in this.behaviors) { manipulationMode |= behavior.DesiredManipulationMode; behavior.OnPointerPressed(e); if (e.Handled) { break; } } if (manipulationMode != ManipulationModes.None) { this.ManipulationMode = manipulationMode; } }
private void GetInput() { if (Input.GetButtonDown("SwitchManipulation")) { switch (manipulationMode) { case ManipulationModes.Pyramid: manipulationMode = ManipulationModes.Mesh; break; case ManipulationModes.Mesh: manipulationMode = ManipulationModes.Pyramid; break; default: manipulationMode = ManipulationModes.Pyramid; break; } } strecht = Input.GetAxisRaw("StretchMeshTrigger"); shrink = -1f * Input.GetAxisRaw("ShrinkMeshTrigger"); // x and B button if (Input.GetButton("StretchMesh")) { strecht = 1f; } if ((Input.GetButton("ShrinkMesh"))) { shrink = -1f; } shrink = manipulationSpeed * shrink; strecht = manipulationSpeed * strecht; }
public ManipulationInputProcessor(GestureRecognizer gr, FrameworkElement target, FrameworkElement referenceframe) { if (gr == null || target == null) { throw new InvalidOperationException("You must provide valid arguments"); } this.gestureRecognizer = gr; this.element = target; this.reference = referenceframe != null ? referenceframe : target; //this.elementInitialOpacity = 1;// element.Opacity; this.containerSize = new Size(target.ActualWidth, 0); previousManipulationModes = element.ManipulationMode; element.ManipulationMode = ManipulationModes.System | ManipulationModes.TranslateX | ManipulationModes.TranslateInertia; this.gestureRecognizer.GestureSettings = GestureSettings.ManipulationTranslateX | GestureSettings.ManipulationTranslateInertia; // Set up pointer event handlers. These receive input events that are used by the gesture recognizer. this.element.PointerCanceled += OnPointerCanceled; //this.element.PointerPressed += OnPointerPressed; this.element.PointerReleased += OnPointerReleased; this.element.PointerCaptureLost += OnPointerCaptureLost; this.element.PointerMoved += OnPointerMoved; // Set up event handlers to respond to gesture recognizer output this.gestureRecognizer.ManipulationStarted += OnManipulationStarted; this.gestureRecognizer.ManipulationUpdated += OnManipulationUpdated; this.gestureRecognizer.ManipulationCompleted += OnManipulationCompleted; InitializeTransforms(); }
private static Manipulations2D ConvertMode(ManipulationModes mode) { Manipulations2D manipulations = Manipulations2D.None; if ((mode & ManipulationModes.TranslateX) != 0) { manipulations |= Manipulations2D.TranslateX; } if ((mode & ManipulationModes.TranslateY) != 0) { manipulations |= Manipulations2D.TranslateY; } if ((mode & ManipulationModes.Scale) != 0) { manipulations |= Manipulations2D.Scale; } if ((mode & ManipulationModes.Rotate) != 0) { manipulations |= Manipulations2D.Rotate; } return manipulations; }
public static bool IsSupported(this ManipulationModes mode) => mode == ManipulationModes.All || (mode & _unsupported) == 0;
partial void OnManipulationModeChanged(ManipulationModes oldMode, ManipulationModes newMode);
private void SetMode(ManipulationModes mode) { Output.Text = ""; TheScroller.ChangeView(horizontalOffset: 0, verticalOffset: 0, null); TouchTarget.ManipulationMode = mode; }
public static void SetManipulationMode(System.Windows.UIElement element, ManipulationModes mode) { }
public static bool IsSupported(this ManipulationModes mode) => mode == ManipulationModes.None || mode >= ManipulationModes.All;
//private async void Map_Tapped(object sender, TappedRoutedEventArgs e) { // // Create graphic for tap location // Graphic graphic = new Graphic() { // Symbol = App.Current.Resources["TappedMarkerSymbol"] as Symbol, // Geometry = this.Map.ScreenToMap(e.GetPosition(this.Map)) // }; // // Add to local map // GraphicsLayer layer = this.Map.Layers["markers"] as GraphicsLayer; // layer.Graphics.Add(graphic); // // Send to remote peer // if (this._peers.Count == 0) { return; } // foreach (MapPeer peer in this._peers) { // // Send extent message // await this.PeerSend(peer, MessageType.Ink, graphic.ToJson()); // } //} // // METHODS // private async void ToggleButton_Checked(object sender, RoutedEventArgs e) { if (sender == this.ToggleButtonConnect) { // Open toast this.PopupNotifications.IsOpen = true; // Check if wifi-direct is support bool supported = (PeerFinder.SupportedDiscoveryTypes & PeerDiscoveryTypes.Browse) == PeerDiscoveryTypes.Browse; if (!supported) { await ProximityMapEnvironment.Default.Log("This device does not supported Wifi Direct", false); await Task.Delay(2000); this.PopupNotifications.IsOpen = false; return; } // Start listening for proximate peers PeerFinder.Start(); // Be available for future connections PeerFinder.ConnectionRequested += this.PeerConnectionRequested; // Find peers await this.ConnectToPeers(); } else if (sender == this.ToggleButtonSketch) { this.SketchControl.Height = Window.Current.Bounds.Height; this._modes = this.Map.ManipulationMode; this.Map.ManipulationMode = ManipulationModes.None; this._inkManager.IsEnabled = true; this.PopupSketch.IsOpen = true; } else if (sender == this.ToggleButtonNatGeo) { this.Map.Layers["natgeo_"].Visibility = Visibility.Visible; this.Map.Layers["topo___"].Visibility = Visibility.Collapsed; this.Map.Layers["imagery"].Visibility = Visibility.Collapsed; this.Map.Layers["streets"].Visibility = Visibility.Collapsed; this.ToggleButtonTopo.IsChecked = false; this.ToggleButtonSatellite.IsChecked = false; this.ToggleButtonStreet.IsChecked = false; } else if (sender == this.ToggleButtonTopo) { this.Map.Layers["natgeo_"].Visibility = Visibility.Collapsed; this.Map.Layers["topo___"].Visibility = Visibility.Visible; this.Map.Layers["imagery"].Visibility = Visibility.Collapsed; this.Map.Layers["streets"].Visibility = Visibility.Collapsed; this.ToggleButtonNatGeo.IsChecked = false; this.ToggleButtonSatellite.IsChecked = false; this.ToggleButtonStreet.IsChecked = false; } else if (sender == this.ToggleButtonSatellite) { this.Map.Layers["natgeo_"].Visibility = Visibility.Collapsed; this.Map.Layers["topo___"].Visibility = Visibility.Collapsed; this.Map.Layers["imagery"].Visibility = Visibility.Visible; this.Map.Layers["streets"].Visibility = Visibility.Collapsed; this.ToggleButtonNatGeo.IsChecked = false; this.ToggleButtonTopo.IsChecked = false; this.ToggleButtonStreet.IsChecked = false; } else if (sender == this.ToggleButtonStreet) { this.Map.Layers["natgeo_"].Visibility = Visibility.Collapsed; this.Map.Layers["topo___"].Visibility = Visibility.Collapsed; this.Map.Layers["imagery"].Visibility = Visibility.Collapsed; this.Map.Layers["streets"].Visibility = Visibility.Visible; this.ToggleButtonNatGeo.IsChecked = false; this.ToggleButtonTopo.IsChecked = false; this.ToggleButtonSatellite.IsChecked = false; } }
void OnRadioChecked(object sender, RoutedEventArgs args) { currentMode = (ManipulationModes)(sender as RadioButton).Content; }