//********************************** Banshee Engine (www.banshee3d.com) **************************************************// //**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************// using System; using System.Runtime.CompilerServices; using bs; namespace bs.Editor { /** @addtogroup Handles * @{ */ /// /// Handle slider that returns a delta value as you drag the pointer along a plane. For intersection purposes the line /// is internally by a quadrilateral (a bounded plane). /// public sealed class HandleSliderPlane : HandleSlider { /// /// Creates a new plane handle slider. /// /// Handle that the slider belongs to. /// First direction of the plane. The x component of returned delta value will be in this /// direction. Should be perpendicular to . /// Second direction of the plane. The y component of returned delta value will be in this /// direction. Should be perpendicular to . /// Length of the quadrilateral in both directions. /// If true the handle slider will always try to maintain the same visible area in the /// viewport regardless of distance from camera. /// Layer that allows filtering of which sliders are interacted with from a specific camera. public HandleSliderPlane(Handle parentHandle, Vector3 dir1, Vector3 dir2, float length, bool fixedScale = true, UInt64 layer = 1) :base(parentHandle) { Internal_CreateInstance(this, ref dir1, ref dir2, length, fixedScale, layer); } /// /// Returns a delta value that is the result of dragging/sliding the pointer along the plane. Returned movement is /// in terms of the two directions originally provided when constructing the slider. This changes every frame and /// will be zero unless the slider is active. /// public Vector2 Delta { get { Vector2 value; Internal_GetDelta(mCachedPtr, out value); return value; } } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_CreateInstance(HandleSliderPlane instance, ref Vector3 dir1, ref Vector3 dir2, float length, bool fixedScale, UInt64 layer); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_GetDelta(IntPtr nativeInstance, out Vector2 value); } /** @} */ }