Exemple #1
0
ViewDragger::ViewDragger(ds::ui::Sprite& parent)
	: AutoUpdate(parent.getEngine())
	, mParent(parent)
	, mMomentum(parent.getEngine())
	, mIsTouchy(false)
	, mReturnTime(0.35f) 
{
	mParent.enable(true);
	mParent.enableMultiTouch(ds::ui::MULTITOUCH_INFO_ONLY);
	mParent.setProcessTouchCallback([this](ds::ui::Sprite* bs, const ds::ui::TouchInfo& ti){ onTouched(ti); });

	mMomentum.setMomentumParent(&mParent);
	mMomentum.setMass(8.0f);
	mMomentum.setFriction(0.5f);

	mBoundingArea = ci::Rectf(0.0f, 0.0f, mParent.getEngine().getWorldWidth(), mParent.getEngine().getWorldHeight());
}
Exemple #2
0
/**
 * \class na::ViewDragger
 */
ViewDragger::ViewDragger(Globals& g, ds::ui::Sprite& parent)
		: mParent(parent)
		, mMomentum(parent.getEngine())
		, mIsTouchy(false)
		, mReturnTime(g.getSettingsLayout().getFloat("media_viewer:check_bounds:return_time", 0, 0.6f)) {
	mParent.enable(true);
	mParent.enableMultiTouch(ds::ui::MULTITOUCH_INFO_ONLY);
	mParent.setProcessTouchCallback([this](ds::ui::Sprite* bs, const ds::ui::TouchInfo& ti){ onTouched(ti);});

	mMomentum.setMomentumParent(&mParent);
	mMomentum.setMass(8.0f);
	mMomentum.setFriction(0.5f);
}