private async Task OnZoomChanged()
        {
            ZoomChanged?.Invoke(this, new RoutedEventArgs());
            await UpdateZoom();

            TransportControls?.UpdateZoomButton();
        }
Exemple #2
0
 private void mapControl_OnMapZoomChanged()
 {
     if (ZoomChanged != null)
     {
         ZoomChanged.Invoke(mapControl, EventArgs.Empty);
     }
 }
Exemple #3
0
 protected override void NewTitle(string title)
 {
     if (!String.IsNullOrEmpty(title))
     {
         double newLat, newLong, newZoom;
         // Incoming title should look like "6, (-27.15, 151.25)"
         // That is Zoom, then lat, long pair
         // We remove the brackets and split on the commas
         title = title.Replace("(", "");
         title = title.Replace(")", "");
         string[] parts = title.Split(new char[] { ',' });
         if (Double.TryParse(parts[0], out newZoom) && newZoom != _zoom)
         {
             _zoom = newZoom;
             if (ZoomChanged != null)
             {
                 ZoomChanged.Invoke(this, EventArgs.Empty);
             }
         }
         if (Double.TryParse(parts[1], out newLat) &&
             Double.TryParse(parts[2], out newLong) &&
             (newLat != _center.Latitude || newLong != Center.Longitude))
         {
             _center.Latitude  = newLat;
             _center.Longitude = newLong;
             if (PositionChanged != null)
             {
                 PositionChanged.Invoke(this, EventArgs.Empty);
             }
         }
     }
 }
Exemple #4
0
 private void vZoom_ValueChanged(object sender, EventArgs e)
 {
     if (ZoomChanged != null)
     {
         ZoomChanged.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #5
0
 private void selectedIndexChanged(object sender, EventArgs e)
 {
     spriteGrid1.Zoom = zoom.SelectedIndex + 1;
     spriteGrid1.Size = new Size(spriteGrid1.MaximumSize.Width,
                                 spriteGrid1.MaximumSize.Height);
     AdaptSize();
     ZoomChanged?.Invoke();
 }
Exemple #6
0
        /// <summary>
        /// Apply the new animated _zoom value to the actual ScaleTransform and fire the ZoomChanged event.
        /// </summary>
        void OnZoomChanged()
        {
            _scale.ScaleX = _scale.ScaleY = _zoom;

            ZoomChanged?.Invoke(this, EventArgs.Empty);

            // focus rectangles may need to be repainted.
            _target.InvalidateVisual();
        }
Exemple #7
0
 internal void SetZoom(int zoom, bool invoke = false)
 {
     if (scintilla.Margins[0].Width > 0)
     {
         scintilla.Margins[0].Width = Math.Max(20, 30 + 3 * zoom);
     }
     if (scintilla.Zoom != zoom)
     {
         scintilla.Zoom = zoom;
     }
     if (invoke)
     {
         ZoomChanged?.Invoke(this, scintilla.Zoom);
     }
 }
Exemple #8
0
 /// <summary>
 /// Internal handler for the zoom changed event.
 /// </summary>
 protected void OnZoomChanged()
 {
     if (ZoomChanged != null)
         ZoomChanged.Invoke(this);
  
     if (m_ZoomedSection == -1)
     {
         if (PanelUnZoomed != null)
             PanelUnZoomed.Invoke(this);
     }
     else
     {
         if (PanelZoomed != null)
             PanelZoomed.Invoke(this);
     }
 }
Exemple #9
0
        /// <summary>
        ///     Zoom to the given factor.
        /// </summary>
        /// <param name='zoom'>
        ///     A zoom factor, expressed as a double.
        /// </param>
        /// <param name='x'>
        ///     The point of the viewport around which to zoom.
        /// </param>
        /// <param name='y'>
        ///     The point of the viewport around which to zoom.
        /// </param>
        void DoZoom(double zoom, int x, int y)
        {
            Fit = zoom == MIN_ZOOM;

            if (zoom == this.zoom || Math.Abs(this.zoom - zoom) < Double.Epsilon)
            {
                // Don't recalculate if the zoom factor stays the same.
                return;
            }

            // Clamp the zoom factor within the [ MIN_ZOOM , MAX_ZOOM ] interval.
            zoom = Math.Max(Math.Min(zoom, MAX_ZOOM), MIN_ZOOM);

            this.zoom = zoom;

            int    x_offset = scaled_width < Allocation.Width ? (int)(Allocation.Width - scaled_width) / 2 : -XOffset;
            int    y_offset = scaled_height < Allocation.Height ? (int)(Allocation.Height - scaled_height) / 2 : -YOffset;
            double x_anchor = (double)(x - x_offset) / (double)scaled_width;
            double y_anchor = (double)(y - y_offset) / (double)scaled_height;

            ComputeScaledSize();

            AdjustmentsChanged -= ScrollToAdjustments;
            if (scaled_width < Allocation.Width)
            {
                Hadjustment.Value = XOffset = 0;
            }
            else
            {
                Hadjustment.Value = XOffset = Clamp((int)(x_anchor * scaled_width - x), 0, (int)(Hadjustment.Upper - Hadjustment.PageSize));
            }
            if (scaled_height < Allocation.Height)
            {
                Vadjustment.Value = YOffset = 0;
            }
            else
            {
                Vadjustment.Value = YOffset = Clamp((int)(y_anchor * scaled_height - y), 0, (int)(Vadjustment.Upper - Vadjustment.PageSize));
            }
            AdjustmentsChanged += ScrollToAdjustments;

            ZoomChanged?.Invoke(this, EventArgs.Empty);

            QueueDraw();
        }
Exemple #10
0
        private void UpdateMatrices()
        {
            zoom = Utils.Clamp(0.25f, 4.00f, zoom);

            if (Math.Abs(zoom - zoomLast) > 0.01f)
            {
                zoomLast = zoom;
                ZoomChanged?.Invoke(this, zoom);
            }

            transformation.Reset();
            transformation.Translate(translation.X, translation.Y);
            transformation.Scale(zoom, zoom);

            inverse_transformation.Reset();
            inverse_transformation.Scale(1.0f / zoom, 1.0f / zoom);
            inverse_transformation.Translate(-translation.X, -translation.Y);
        }
Exemple #11
0
        /// <summary>
        /// Internal handler for the zoom changed event.
        /// </summary>
        protected void OnZoomChanged()
        {
            if (ZoomChanged != null)
            {
                ZoomChanged.Invoke(this, EventArgs.Empty);
            }

            if (m_ZoomedSection == -1)
            {
                if (PanelUnZoomed != null)
                {
                    PanelUnZoomed.Invoke(this, EventArgs.Empty);
                }
            }
            else
            {
                if (PanelZoomed != null)
                {
                    PanelZoomed.Invoke(this, EventArgs.Empty);
                }
            }
        }
Exemple #12
0
        protected override void OnSizeAllocated(Gdk.Rectangle allocation)
        {
            min_zoom = ComputeMinZoom(upscale);

            if (Fit || zoom < MIN_ZOOM)
            {
                zoom = MIN_ZOOM;
            }
            // Since this affects the zoom_scale we should alert it
            ZoomChanged?.Invoke(this, EventArgs.Empty);

            ComputeScaledSize();

            OnSizeAllocatedChildren();

            if (IsRealized)
            {
                GdkWindow.MoveResize(allocation.X, allocation.Y, allocation.Width, allocation.Height);
            }

            if (XOffset > Hadjustment.Upper - Hadjustment.PageSize)
            {
                ScrollTo((int)(Hadjustment.Upper - Hadjustment.PageSize), YOffset, false);
            }
            if (YOffset > Vadjustment.Upper - Vadjustment.PageSize)
            {
                ScrollTo(XOffset, (int)(Vadjustment.Upper - Vadjustment.PageSize), false);
            }

            base.OnSizeAllocated(allocation);

            if (Fit)
            {
                ZoomFit(upscale);
            }
        }
Exemple #13
0
 protected virtual void OnZoomChanged(object sender, EventArgs e)
 {
     float.TryParse(txtZoom.Text, out _zoom);
     _eventArgs.Zoom = _zoom;
     ZoomChanged?.Invoke(this, _eventArgs);
 }
Exemple #14
0
 private void OnZoomChanged(object sender, ZoomLevelChangedEventArgs args)
 {
     ZoomChanged?.Invoke((IWpfTextView)sender, args.NewZoomLevel);
 }
Exemple #15
0
 /// <summary>
 /// Raises the ZoomChanged event when the zoom factor changed.
 /// </summary>
 protected virtual void OnZoomChanged(EventArgs e)
 {
     ZoomChanged?.Invoke(this, e);
 }
Exemple #16
0
 private void zoomSelectedIndexChanged(object sender, EventArgs e)
 {
     ZoomChanged?.Invoke(zoom.SelectedIndex + 1);
 }
 void HandleStaticZoomChanged(object sender, EventArgs e)
 {
     DisposeFont();
     ZoomChanged?.Invoke(this, EventArgs.Empty);
     OnChanged(EventArgs.Empty);
 }
Exemple #18
0
 private void OnZoomChanged(EventArgs e)
 {
     ZoomChanged?.Invoke(this, e);
 }
Exemple #19
0
 private void txtExpression_ZoomChanged(object sender, EventArgs e)
 {
     ZoomChanged?.Invoke(this, txtExpression.Zoom);
 }
 private void DecreaseZoomButton_Click(object sender, EventArgs e)
 {
     ZoomChanged.Invoke(-1);
 }
Exemple #21
0
 private void OnZoomChanged()
 {
     ZoomChanged?.Invoke(this, new CanvasZoomChangedEventArgs(zoomFactor));
 }
Exemple #22
0
 private void SetZoom(float value)
 {
     _zoom = Max(0f, value);
     RefreshImage();
     ZoomChanged?.Invoke(this, new EventArgs());
 }
Exemple #23
0
 protected virtual void OnZoomChanged()
 {
     ZoomChanged?.Invoke(this, EventArgs.Empty);
 }
 public void SetZoom(double newZoom)
 {
     Zoom = newZoom;
     ZoomChanged?.Invoke();
     Refresh();
 }
Exemple #25
0
 void OnZoomChanged()
 {
     ZoomChanged?.Invoke(this, EventArgs.Empty);
 }
Exemple #26
0
 private void RaiseZoomChanged()
 {
     ZoomChanged?.Invoke(this, new EventArgs());
 }