public KChartSKControl() : base() { chartControl = this; chartControl.Location = new Point(0, 0); Label toolTip = WinGui.winGui.label_Tooltip; toolTip.Visible = false; toolTip.BackColor = WinControls.cPanelButtonDeselected; toolTip.Font = WinGui.winGui.GetFont(8, true); toolTip.MouseEnter += (object sender, EventArgs e) => { UpdateTooltip(new Point(0, 0), ""); }; /* Initialize Interface KTouchClient with a locally-sourced KTouchClientData closure */ touch = new KTouchClientData( invalidateSurface: () => { InvalidateAndUpdate(); }, setManualPinchPan: (Swipe pinchPan) => { KChartHandler.SetManualPinchPan(pinchPan); } ); touch.onTouchSwipeOrMouseDrag = OnMouseDrag; touch.onTouchSwipeOrMouseDragEnd = OnMouseDragEnd; touch.onTouchDoubletapOrMouseClick = OnMouseClick; touch.onTouchPinchOrMouseZoom = OnMouseZoom; touch.lastPinchPan = Swipe.Id(); touch.incrementalScaling = Swipe.Id(); touch.incrementalTranslation = Swipe.Id(); KChartHandler.RegisterKTouchClientData(touch); }
private void OnMouseClick(SKPoint p) { touch.lastPinchPan = Swipe.Id(); touch.incrementalScaling = Swipe.Id(); touch.incrementalTranslation = Swipe.Id(); touch.setManualPinchPan?.Invoke(touch.lastPinchPan); touch.invalidateSurface(); }
private void OnMouseDragEnd(SKPoint from, SKPoint to) { if (touch.swiping) { touch.swiping = false; touch.lastPinchPan = touch.lastPinchPan * touch.incrementalScaling * touch.incrementalTranslation; touch.incrementalScaling = Swipe.Id(); touch.incrementalTranslation = Swipe.Id(); touch.setManualPinchPan?.Invoke(touch.lastPinchPan); touch.invalidateSurface(); } }
private KTouchClientData touch = null; // data for pan&zoom by mouse drag and scroll private void OnLoad() { this.WantsLayer = true; this.LayerContentsRedrawPolicy = NSViewLayerContentsRedrawPolicy.OnSetNeedsDisplay; chartControl = this; /* Initialize Interface KTouchClient with a locally-sourced KTouchClientData closure */ touch = new KTouchClientData( invalidateSurface: () => { Invalidate(); }, setManualPinchPan: (Swipe pinchPan) => { KChartHandler.SetManualPinchPan(pinchPan); } ); touch.onTouchSwipeOrMouseDrag = OnMouseDrag; touch.onTouchSwipeOrMouseDragEnd = OnMouseDragEnd; touch.onTouchDoubletapOrMouseClick = OnMouseClick; touch.onTouchPinchOrMouseZoom = OnMouseZoom; touch.lastPinchPan = Swipe.Id(); touch.incrementalScaling = Swipe.Id(); touch.incrementalTranslation = Swipe.Id(); KChartHandler.RegisterKTouchClientData(touch); Tracking(); }