示例#1
0
        /// <summary>
        /// Response mouse left button up.
        /// </summary>
        protected virtual void OnMouseUp()
        {
            if (!isEnabled)
            {
                return;
            }

            if (selfLock)
            {
                isLock = !isLock;
            }

            if (isLock)
            {
                currentOffset = downOffset * lockPercent;
                OnLock.Invoke();
            }
            else
            {
                IsDown        = false;
                currentOffset = 0;
                OnUp.Invoke();
            }
            Translate(currentOffset);

            if (useLED && !isLock)
            {
                LED.TurnOff();
            }
        }
示例#2
0
        /// <summary>
        /// Response mouse left button down.
        /// </summary>
        protected virtual void OnMouseDown()
        {
            if (!isEnabled)
            {
                return;
            }

            IsDown        = true;
            currentOffset = downOffset;
            Translate(currentOffset);

            if (useLED)
            {
                LED.TurnOn();
            }

            OnDown.Invoke();
        }