本文整理汇总了C#中ScrollDirection类的典型用法代码示例。如果您正苦于以下问题:C# ScrollDirection类的具体用法?C# ScrollDirection怎么用?C# ScrollDirection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScrollDirection类属于命名空间,在下文中一共展示了ScrollDirection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseScrolledEventArgs
public MouseScrolledEventArgs (long timestamp, double x, double y, ScrollDirection direction)
{
X = x;
Y = y;
Timestamp = timestamp;
Direction = direction;
}
示例2: LScrollView
public LScrollView()
{
direction = ScrollDirection.BOTH;
lastMovePoint = Vector2.zero;
bounceable = true;
scrollDistance = Vector2.zero;
dragable = true;
maxOffset = Vector2.zero;
minOffset = Vector2.zero;
}
示例3: HandleKeyPress
public override bool HandleKeyPress(KeyInput e)
{
switch (e.KeyName)
{
case "up": Keyboard = Keyboard.Set(ScrollDirection.Up, (e.Event == KeyInputEvent.Down)); return true;
case "down": Keyboard = Keyboard.Set(ScrollDirection.Down, (e.Event == KeyInputEvent.Down)); return true;
case "left": Keyboard = Keyboard.Set(ScrollDirection.Left, (e.Event == KeyInputEvent.Down)); return true;
case "right": Keyboard = Keyboard.Set(ScrollDirection.Right, (e.Event == KeyInputEvent.Down)); return true;
}
return false;
}
示例4: GetScrollCursor
public static string GetScrollCursor(Widget w, ScrollDirection edge, int2 pos)
{
if (!Game.Settings.Game.ViewportEdgeScroll || Ui.MouseOverWidget != w)
return null;
var blockedDirections = Game.viewport.GetBlockedDirections();
foreach (var dir in directions)
if (edge.Includes(dir.Key))
return dir.Value + (blockedDirections.Includes(dir.Key) ? "-blocked" : "");
return null;
}
示例5: ConvertScrollDirection
public static Gdk.ScrollDirection ConvertScrollDirection(ScrollDirection d)
{
switch (d) {
case ScrollDirection.Up:
return Gdk.ScrollDirection.Up;
case ScrollDirection.Down:
return Gdk.ScrollDirection.Down;
case ScrollDirection.Left:
return Gdk.ScrollDirection.Left;
case ScrollDirection.Right:
return Gdk.ScrollDirection.Right;
}
throw new InvalidOperationException("Invalid mouse scroll direction value: " + d);
}
示例6: OnPointChanged
private void OnPointChanged() {
if (_scrolledDirection != ScrollDirection.None
&& PointChanged != null) {
if (_scrolledDirection.HasFlag(ScrollDirection.Horizontal)) {
EnsureXPositions();
}
if (_scrolledDirection.HasFlag(ScrollDirection.Vertical)) {
EnsureYPositions();
}
PointChanged(this, new PointChangedEventArgs(_scrolledDirection));
}
_scrolledDirection = ScrollDirection.None;
}
示例7: OnScrolled
protected override void OnScrolled (ScrollDirection direction, ModifierType mod)
{
if ((mod & ModifierType.ShiftMask) != ModifierType.ShiftMask)
return;
int shift = HueShift;
if (direction == Gdk.ScrollDirection.Up)
shift += 5;
else if (direction == Gdk.ScrollDirection.Down)
shift -= 5;
if (shift < 0)
shift += 360;
shift %= 360;
HueShift = shift;
}
示例8: Tick
public override void Tick()
{
edgeDirections = ScrollDirection.None;
if (Game.Settings.Game.ViewportEdgeScroll && Game.HasInputFocus)
edgeDirections = CheckForDirections();
if (keyboardDirections != ScrollDirection.None || edgeDirections != ScrollDirection.None)
{
var scroll = float2.Zero;
foreach (var kv in ScrollOffsets)
if (keyboardDirections.Includes(kv.Key) || edgeDirections.Includes(kv.Key))
scroll += kv.Value;
var length = Math.Max(1, scroll.Length);
scroll *= (1f / length) * Game.Settings.Game.ViewportEdgeScrollStep;
worldRenderer.Viewport.Scroll(scroll, false);
}
}
示例9: YieldKeyboardFocus
public override bool YieldKeyboardFocus()
{
keyboardDirections = ScrollDirection.None;
return base.YieldKeyboardFocus();
}
示例10: ScrollProgrammatically
/// <summary>
/// Does the programmatic scrolling for this element.
/// </summary>
/// <param name="scrollDirection">The direction to scroll.</param>
/// <param name="scrollAmount">The amount to scroll.</param>
/// <seealso cref="InitializeProgrammaticScroll"/>
public override void ScrollProgrammatically(ScrollDirection scrollDirection, ScrollAmount scrollAmount)
{
// Should never get called because InitializeProgrammaticScroll() returns false.
throw new NotSupportedException();
}
示例11: HandleKeyPress
public override bool HandleKeyPress(KeyInput e)
{
var key = Hotkey.FromKeyInput(e);
var ks = Game.Settings.Keys;
if (key == ks.MapScrollUp)
{
keyboardDirections = keyboardDirections.Set(ScrollDirection.Up, e.Event == KeyInputEvent.Down);
return true;
}
if (key == ks.MapScrollDown)
{
keyboardDirections = keyboardDirections.Set(ScrollDirection.Down, e.Event == KeyInputEvent.Down);
return true;
}
if (key == ks.MapScrollLeft)
{
keyboardDirections = keyboardDirections.Set(ScrollDirection.Left, e.Event == KeyInputEvent.Down);
return true;
}
if (key == ks.MapScrollRight)
{
keyboardDirections = keyboardDirections.Set(ScrollDirection.Right, e.Event == KeyInputEvent.Down);
return true;
}
return false;
}
示例12: Tick
public override void Tick(World world)
{
Edge = ScrollDirection.None;
if (Game.Settings.Game.ViewportEdgeScroll && Game.HasInputFocus)
{
// Check for edge-scroll
if (Viewport.LastMousePos.X < EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Left, true);
if (Viewport.LastMousePos.Y < EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Up, true);
if (Viewport.LastMousePos.X >= Game.viewport.Width - EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Right, true);
if (Viewport.LastMousePos.Y >= Game.viewport.Height - EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Down, true);
}
if(Keyboard != ScrollDirection.None || Edge != ScrollDirection.None)
{
var scroll = new float2(0, 0);
// Modified to use the ViewportEdgeScrollStep setting - Gecko
if (Keyboard.Includes(ScrollDirection.Up) || Edge.Includes(ScrollDirection.Up))
scroll += new float2(0, -(Game.Settings.Game.ViewportEdgeScrollStep * 100));
if (Keyboard.Includes(ScrollDirection.Right) || Edge.Includes(ScrollDirection.Right))
scroll += new float2((Game.Settings.Game.ViewportEdgeScrollStep * 100), 0);
if (Keyboard.Includes(ScrollDirection.Down) || Edge.Includes(ScrollDirection.Down))
scroll += new float2(0, (Game.Settings.Game.ViewportEdgeScrollStep * 100));
if (Keyboard.Includes(ScrollDirection.Left) || Edge.Includes(ScrollDirection.Left))
scroll += new float2(-(Game.Settings.Game.ViewportEdgeScrollStep * 100), 0);
Game.viewport.Scroll(scroll);
}
}
示例13: GetScrolledPercentage
/// <summary>
/// Gets the amount scrolled in percentage.
/// </summary>
/// <param name="srollDirection">The direction for which data is required.</param>
/// <param name="scrollElement">The element which is either the vertical or horizontal scroll bar.</param>
/// <returns>The amount in percentage.</returns>
/// <seealso cref="InitializeProgrammaticScroll"/>
public override int GetScrolledPercentage(ScrollDirection scrollDirection, IUITechnologyElement scrollElement)
{
// Should never get called because InitializeProgrammaticScroll() returns false.
throw new NotSupportedException();
}
示例14: VerifyNotSame
/// -------------------------------------------------------------------
/// <summary>Changes the position to a new random position if the two are the same</summary>
/// -------------------------------------------------------------------
private void VerifyNotSame(ref double positionToChange, string positionToChangeStr, double otherPosition, string otherPositionStr, ArrayList validPositions, ScrollDirection scrollDirection, double min, double max, RandomBoundaries boundaries, CheckType checkType)
{
if (positionToChange.Equals(otherPosition))
{
if (validPositions.Count < 4)
ThrowMe(CheckType.IncorrectElementConfiguration, validPositions.Count.ToString() + " valid scroll positions, not enough for test (4 minimum). Is your display resolution set too low?");
for (int i = 0; i < 10 && (positionToChange.Equals(otherPosition)); i++)
{
Comment("\"{0}\"({1}) and \"{2}\"({3}) were found to be the same. Find a new \"{0}\"", positionToChange, positionToChangeStr, otherPosition, otherPositionStr);
// false says don't incremenet m_TestStep TSC_RandomPosition
positionToChange = TSC_RandomPosition(scrollDirection, min, max, boundaries, false, checkType);
}
if (positionToChange.Equals(otherPosition))
ThrowMe(CheckType.Verification, "Cannot find a random \"{0}\" position", positionToChangeStr);
Comment("Found new \"{0}\" position : {1}", positionToChangeStr, positionToChange);
}
}
示例15: Tick
public override void Tick()
{
Edge = ScrollDirection.None;
if (Game.Settings.Game.ViewportEdgeScroll && Game.HasInputFocus && Widget.MouseOverWidget == this)
{
// Check for edge-scroll
if (Viewport.LastMousePos.X < EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Left, true);
if (Viewport.LastMousePos.Y < EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Up, true);
if (Viewport.LastMousePos.X >= Game.viewport.Width - EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Right, true);
if (Viewport.LastMousePos.Y >= Game.viewport.Height - EdgeScrollThreshold)
Edge = Edge.Set(ScrollDirection.Down, true);
}
if(Keyboard != ScrollDirection.None || Edge != ScrollDirection.None)
{
var scroll = new float2(0, 0);
// Modified to use the ViewportEdgeScrollStep setting - Gecko
if (Keyboard.Includes(ScrollDirection.Up) || Edge.Includes(ScrollDirection.Up))
scroll += new float2(0, -1);
if (Keyboard.Includes(ScrollDirection.Right) || Edge.Includes(ScrollDirection.Right))
scroll += new float2(1, 0);
if (Keyboard.Includes(ScrollDirection.Down) || Edge.Includes(ScrollDirection.Down))
scroll += new float2(0, 1);
if (Keyboard.Includes(ScrollDirection.Left) || Edge.Includes(ScrollDirection.Left))
scroll += new float2(-1, 0);
float length = Math.Max(1, scroll.Length);
scroll.X = (scroll.X / length) * Game.Settings.Game.ViewportEdgeScrollStep;
scroll.Y = (scroll.Y / length) * Game.Settings.Game.ViewportEdgeScrollStep;
Game.viewport.Scroll(scroll);
}
base.Tick();
}