本文整理汇总了C++中LayerList::front方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerList::front方法的具体用法?C++ LayerList::front怎么用?C++ LayerList::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerList
的用法示例。
在下文中一共展示了LayerList::front方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drop_range_op
static DocRange drop_range_op(
Doc* doc,
const Op op,
const DocRange& from,
DocRangePlace place,
const TagsHandling tagsHandling,
DocRange to)
{
// Convert "first child" operation into a insert after last child.
LayerGroup* parent = nullptr;
if (to.type() == DocRange::kLayers &&
!to.selectedLayers().empty()) {
if (place == kDocRangeFirstChild &&
(*to.selectedLayers().begin())->isGroup()) {
place = kDocRangeAfter;
parent = static_cast<LayerGroup*>((*to.selectedLayers().begin()));
to.clearRange();
to.startRange(parent->lastLayer(), -1, DocRange::kLayers);
to.endRange(parent->lastLayer(), -1);
}
else {
parent = (*to.selectedLayers().begin())->parent();
}
// Check that we're not moving a group inside itself
for (auto moveThis : from.selectedLayers()) {
if (moveThis == parent ||
(moveThis->isGroup() &&
has_child(static_cast<LayerGroup*>(moveThis), parent)))
return from;
}
}
if (place != kDocRangeBefore &&
place != kDocRangeAfter) {
ASSERT(false);
throw std::invalid_argument("Invalid 'place' argument");
}
Sprite* sprite = doc->sprite();
// Check noop/trivial/do nothing cases, i.e., move a range to the same place.
// Also check invalid cases, like moving a Background layer.
switch (from.type()) {
case DocRange::kCels:
if (from == to)
return from;
break;
case DocRange::kFrames:
if (op == Move) {
// Simple cases with one continuos range of frames that are a
// no-op.
if ((from.selectedFrames().ranges() == 1) &&
((to.firstFrame() >= from.firstFrame() &&
to.lastFrame() <= from.lastFrame()) ||
(place == kDocRangeBefore && to.firstFrame() == from.lastFrame()+1) ||
(place == kDocRangeAfter && to.lastFrame() == from.firstFrame()-1)) &&
// If there are tags, this might not be a no-op
(sprite->frameTags().empty() ||
tagsHandling == kDontAdjustTags)) {
return from;
}
}
break;
case DocRange::kLayers:
if (op == Move) {
SelectedLayers srcSelLayers = from.selectedLayers();
SelectedLayers dstSelLayers = to.selectedLayers();
LayerList srcLayers = srcSelLayers.toLayerList();
LayerList dstLayers = dstSelLayers.toLayerList();
ASSERT(!srcLayers.empty());
if (srcLayers.empty())
return from;
// dstLayers can be nullptr when we insert the first child in
// a group.
// Check no-ops when we move layers at the same level (all
// layers with the same parent), all adjacents, and which are
// moved to the same place.
if (!dstSelLayers.empty() &&
srcSelLayers.hasSameParent() &&
dstSelLayers.hasSameParent() &&
are_layers_adjacent(srcLayers) &&
are_layers_adjacent(dstLayers)) {
for (Layer* srcLayer : srcLayers)
if (dstSelLayers.contains(srcLayer))
return from;
if ((place == kDocRangeBefore
&& dstLayers.front() == srcLayers.back()->getNext()) ||
(place == kDocRangeAfter
&& dstLayers.back() == srcLayers.front()->getPrevious()))
return from;
}
//.........这里部分代码省略.........