public void AnimateDisappear() { m_needAnimate = false; for (int i = 0; i < m_label.InternalGetSprites().Length; i++) { ISprite sprite = m_label.InternalGetSprites()[i]; sprite.Alpha = 255; Animator.RemoveAnimation(this, (AnimationKind)((int)AnimationKind.Custom + i)); } FadeTo(0.0f, 100, null); }
public override bool Touch(float x, float y, bool press, bool unpress, int pointer) { if (HitTest(x, y)) { if (press) { bool wasFocused = m_focused; SetFocused(true); Vector2 local = (this.Transform.GetClientPoint(new Vector2(x, y)) - m_label.Position) / m_fontSize; ISprite[] sprites = m_label.InternalGetSprites(); if (sprites.Length > 0) { bool found = false; if (!found && wasFocused) { for (int i = 0; i < sprites.Length; i++) { if (local.X < sprites[i].Position.X + sprites[i].Size.X / 2) { if (i < m_cursorPosition || wasFocused) { UpdateCursor(i - m_cursorPosition); } else if (i >= m_cursorPosition) { UpdateCursor(i - m_cursorPosition - 1); } found = true; break; } } } if (!found) { int last = m_text.Length - 1; UpdateCursor(last - m_cursorPosition + 1); } } } return(true); } return(base.Touch(x, y, press, unpress, pointer)); }
public override bool Touch(float x, float y, bool press, bool unpress, int pointer) { if (press) { SetFocused(true); Vector2 local = (this.Transform.GetClientPoint(new Vector2(x, y)) - m_label.Position) / FontSize; ISprite[] sprites = m_label.InternalGetSprites(); if (sprites.Length > 0) { bool found = false; for (int i = 0; i < sprites.Length; i++) { if (local.X < sprites[i].Position.X + sprites[i].FrameSize.X / 2) { UpdateCursor(i - m_cursorPosition); found = true; break; } } if (!found) { int last = m_text.Length - 1; UpdateCursor(last - m_cursorPosition + 1); } } } if (!press && !unpress && !Hovered) { Hovered = true; WindowController.Instance.OnTouch += UnHoverTouch; } return(true); }
public override bool Touch(float x, float y, bool press, bool unpress, int pointer) { if (press) { bool wasFocused = IsFocused; SetFocused(true); LabelObject label = null; for (int i = 0; i < m_labels.Length; i++) { if (m_labels[i].HitTest(x, y)) { label = m_labels[i]; m_cursorLine = i; break; } } Vector2 local = Transform.GetClientPoint(new Vector2(x, y)) - m_contentOffset; if (label == null) { m_cursorLine = (int)Math.Floor(local.Y / m_lineHeight); m_contentOffset.X = 0; if (m_cursorLine < 0) { m_cursorLine = 0; m_cursorLinePosition = 0; } else { if (m_cursorLine > m_lines.Length - 1) { m_cursorLine = m_lines.Length - 1; } m_cursorLinePosition = m_lines[m_cursorLine].Length; } UpdateCursor(0, 0); } else { bool spriteFound = false; float lx = local.X / FontSize; ISprite[] sprites = label.InternalGetSprites(); for (int i = 0; i < sprites.Length; i++) { if (lx < sprites[i].Position.X + sprites[i].FrameSize.X / 2) { m_cursorLinePosition = i; spriteFound = true; break; } } if (!spriteFound) { if (local.X < label.Position.X) { m_cursorLinePosition = 0; } else if (local.X > label.Position.X + label.Size.X) { m_cursorLinePosition = m_lines[m_cursorLine].Length; } } UpdateCursor(0, 0); } } if (!press && !unpress && !Hovered) { Hovered = true; WindowController.Instance.OnTouch += UnHoverTouch; } return(true); }