コード例 #1
0
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            var    alloc = Allocation;
            double dx, dy;

            evnt.GetPageScrollPixelDeltas(alloc.Width, alloc.Height, out dx, out dy);

            if (dx != 0.0 && hScrollBar.Visible)
            {
                hAdjustment.AddValueClamped(dx);
            }

            if (dy != 0.0 && vScrollBar.Visible)
            {
                vAdjustment.AddValueClamped(dy);
            }

            return((dx != 0.0 || dy != 0.0) || base.OnScrollEvent(evnt));
        }
コード例 #2
0
        // FIXME: if the editors have different adjustment ranges, the pixel deltas
        // don't really feel quite right since they're applied after scaling via the
        // linked adjustment
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            //using the size of an editor for the calculations means pixel deltas apply better
            var alloc = editors[0].Allocation;

            double dx, dy;

            evnt.GetPageScrollPixelDeltas(alloc.Width, alloc.Height, out dx, out dy);

            if (dx != 0.0 && hAdjustment.PageSize < (hAdjustment.Upper - hAdjustment.Lower))
            {
                hAdjustment.AddValueClamped(dx / (alloc.Width / hAdjustment.PageSize));
            }

            if (dy != 0.0 && vAdjustment.PageSize < (vAdjustment.Upper - vAdjustment.Lower))
            {
                vAdjustment.AddValueClamped(dy / (alloc.Height / vAdjustment.PageSize));
            }

            return((dx != 0.0 || dy != 0.0) || base.OnScrollEvent(evnt));
        }