IDirectManipulationPrimaryContent::SetSnapInterval method

Specifies snap points for the inertia end position at uniform intervals.

Syntax


HRESULT SetSnapInterval(
  [in]  DIRECTMANIPULATION_MOTION_TYPES motion,
  [in]  float interval,
  [in]  float offset
);

Parameters

motion [in]

One of the DIRECTMANIPULATION_MOTION_TYPES enumeration values.

interval [in]

The interval between each snap point.

offset [in]

The offset from the coordinate specified in SetSnapCoordinate.

Return value

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Snap point locations are in content coordinate units.

Specify snap points through SetSnapPoints or SetSnapInterval.

If snap points are invalid (for example, outside of the content boundaries), they are ignored and the content is always within the content boundaries.

Snap points are not at boundaries by default. If you wish for content to stop at a boundary, a snap point must be set at the boundary.

Snap points set by SetSnapInterval can be cleared by calling SetSnapInterval with an interval of 0.0f.

Examples

The following example shows how to set the coordinate system for X translation snap points to the origin. Snap points are set every 45 pixels, beginning at the origin along the X-axis.


HRESULT hr = SetSnapCoordinate(testWindow, 0, DIRECTMANIPULATION_MOTION_TRANSLATEX, DIRECTMANIPULATION_COORDINATE_ORIGIN, 0.0f);
hr = pContent->SetSnapInterval(DIRECTMANIPULATION_MOTION_TRANSLATEX, 45.0f, 0.0f);

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

DirectManipulation.h

IDL

DirectManipulation.idl

IID

IID_IDirectManipulationPrimaryContent is defined as C12851E4-1698-4625-B9B1-7CA3EC18630B

See also

IDirectManipulationPrimaryContent
SetSnapCoordinate
SetSnapPoints

 

 

Community Additions

ADD
Show:
© 2014 Microsoft