本文整理汇总了C++中DocumentApi::setMaskPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentApi::setMaskPosition方法的具体用法?C++ DocumentApi::setMaskPosition怎么用?C++ DocumentApi::setMaskPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentApi
的用法示例。
在下文中一共展示了DocumentApi::setMaskPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMouseUp
bool MovingCelState::onMouseUp(Editor* editor, MouseMessage* msg)
{
Document* document = editor->document();
// Here we put back the cel into its original coordinate (so we can
// add an undoer before).
if (m_celOffset != gfx::Point(0, 0)) {
// Put the cels in the original position.
for (size_t i=0; i<m_celList.size(); ++i) {
Cel* cel = m_celList[i];
const gfx::Point& celStart = m_celStarts[i];
cel->setPosition(celStart);
}
// If the user didn't cancel the operation...
if (!m_canceled) {
ContextWriter writer(UIContext::instance(), 500);
Transaction transaction(writer.context(), "Cel Movement", ModifyDocument);
DocumentApi api = document->getApi(transaction);
// And now we move the cel (or all selected range) to the new position.
for (Cel* cel : m_celList) {
api.setCelPosition(writer.sprite(), cel,
cel->x() + m_celOffset.x,
cel->y() + m_celOffset.y);
}
// Move selection if it was visible
if (m_maskVisible)
api.setMaskPosition(document->mask()->bounds().x + m_celOffset.x,
document->mask()->bounds().y + m_celOffset.y);
transaction.commit();
}
// Redraw all editors. We've to notify all views about this
// general update because MovingCelState::onMouseMove() redraws
// only the cels in the current editor. And at this point we'd
// like to update all the editors.
document->notifyGeneralUpdate();
}
// Restore the mask visibility.
if (m_maskVisible) {
document->setMaskVisible(m_maskVisible);
document->generateMaskBoundaries();
}
editor->backToPreviousState();
editor->releaseMouse();
return true;
}