/// <summary> /// インスタンスの複製 /// </summary> /// <returns></returns> public MouseState Clone() { var ret = new MouseState { Pos = (ScreenPos)Pos.Clone(), Delta = Delta, Attr = (Buttons)Attr.Clone(), _paneAtPos = _paneAtPos }; return(ret); }
/// <summary> /// マウスMoveイベント /// </summary> /// <param name="e"></param> public virtual void OnMouseMove(MouseState e) { if (_posDown == null || _zoomDown == null || _scrollDown == null || e.Pane == null) { return; } if (e.Attr.Equals(_trigger)) { // 画面の拡大/縮小 ScreenPos movePos = e.Pos - _posDown; // カーソルの移動量の計算 ScreenPos pdBak = (ScreenPos)_posDown.Clone(); if (_isCenterLock) { _posDown.X = e.Pane.GetPaneRect().LT.X + (e.Pane.GetPaneRect().RB.X - e.Pane.GetPaneRect().LT.X) / 2; _posDown.Y = e.Pane.GetPaneRect().LT.Y + (e.Pane.GetPaneRect().RB.Y - e.Pane.GetPaneRect().LT.Y) / 2; } XyBase zoomNow = _zoomDown + movePos * 3; // ズーム値の算出 速度変更(高解像度に伴い) 2016.11.15 Tono 2→3 // ズーム値を規定範囲内に収める if (zoomNow.X > 4000) { zoomNow.X = 4000; } if (zoomNow.Y > 4000) { zoomNow.Y = 4000; } if (zoomNow.X < 5) { zoomNow.X = 5; } if (zoomNow.Y < 5) { zoomNow.Y = 5; } if (_isSameXY) { zoomNow.Y = zoomNow.X; } Pane.Zoom = (XyBase)zoomNow.Clone(); // ズーム値の反映 // クリックした位置を基準にしてズームするように画面をスクロールする。 double ZoomRatioX = (double)zoomNow.X / _zoomDown.X; // X方向のズーム率の算出 double ZoomRatioY = (double)zoomNow.Y / _zoomDown.Y; // Y方向のズーム率の算出 ScreenPos beforeDownPos = _posDown - _scrollDown - e.Pane.GetPaneRect().LT; // ScreenPos afterDownPos = ScreenPos.FromInt((int)(ZoomRatioX * beforeDownPos.X), (int)(ZoomRatioY * beforeDownPos.Y)); if (_noscrollmove.value == false) { Pane.Scroll = _scrollDown - (afterDownPos - beforeDownPos); } else { _noscrollmove.value = false; } Pane.Invalidate(null); _posDown = pdBak; } else { OnMouseUp(e); } }