Add never_flip_attachments to TOML metadata. (#203)
This adds a new `never_flip_attachments` property to TOML metadata, as discussed in #184, and sets it to `true` for the `face_nest` symbol.pull/205/head
rodzic
dd341b8074
commit
9a80ead5b7
|
@ -37,5 +37,11 @@ attach_to = ["tail", "leg", "arm", "horn", "crown"]
|
|||
# If true, symbol will rotate clockwise instead of default counter-clockwise
|
||||
rotate_clockwise = false
|
||||
|
||||
# If true, this indicates that we should never horizontally flip the
|
||||
# orientation of a symbol when attaching it. Otherwise, we will flip
|
||||
# the symbol horizontally if it's facing left, and flip it horizontally
|
||||
# again if it's facing down.
|
||||
never_flip_attachments = false
|
||||
|
||||
# If true, symbol may be used as large background shape in some compositions.
|
||||
background = false
|
||||
|
|
|
@ -5,5 +5,6 @@ never_be_nested = true
|
|||
|
||||
invert_nested = true
|
||||
|
||||
never_flip_attachments = true
|
||||
|
||||
attach_to = []
|
|
@ -127,14 +127,18 @@ const AttachedCreatureSymbol: React.FC<AttachedCreatureSymbolProps> = ({
|
|||
continue;
|
||||
}
|
||||
|
||||
// If we're attaching something oriented towards the left, horizontally flip
|
||||
// the attachment image.
|
||||
let xFlip = parentAp.normal.x < 0 ? -1 : 1;
|
||||
let xFlip = 1;
|
||||
|
||||
// Er, things look weird if we don't inverse the flip logic for
|
||||
// the downward-facing attachments, like legs...
|
||||
if (parentAp.normal.y > 0) {
|
||||
xFlip *= -1;
|
||||
if (!parent.meta?.never_flip_attachments) {
|
||||
// If we're attaching something oriented towards the left, horizontally flip
|
||||
// the attachment image.
|
||||
xFlip = parentAp.normal.x < 0 ? -1 : 1;
|
||||
|
||||
// Er, things look weird if we don't inverse the flip logic for
|
||||
// the downward-facing attachments, like legs...
|
||||
if (parentAp.normal.y > 0) {
|
||||
xFlip *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
const t = getAttachmentTransforms(parentAp, {
|
||||
|
|
|
@ -30,6 +30,14 @@ type SvgSymbolMetadataBooleans = {
|
|||
* This changes the rotation direction to clockwise.
|
||||
*/
|
||||
rotate_clockwise?: boolean;
|
||||
|
||||
/**
|
||||
* If true, this indicates that we should never horizontally flip the
|
||||
* orientation of a symbol when attaching it. Otherwise, we will flip
|
||||
* the symbol horizontally if it's facing left, and flip it horizontally
|
||||
* again if it's facing down.
|
||||
*/
|
||||
never_flip_attachments?: boolean;
|
||||
};
|
||||
|
||||
const METADATA_BOOLEANS: Set<keyof SvgSymbolMetadataBooleans> = new Set([
|
||||
|
@ -38,6 +46,7 @@ const METADATA_BOOLEANS: Set<keyof SvgSymbolMetadataBooleans> = new Set([
|
|||
"never_be_nested",
|
||||
"invert_nested",
|
||||
"rotate_clockwise",
|
||||
"never_flip_attachments",
|
||||
]);
|
||||
|
||||
function isSvgSymbolMetadataBoolean(
|
||||
|
|
Ładowanie…
Reference in New Issue