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
|
# If true, symbol will rotate clockwise instead of default counter-clockwise
|
||||||
rotate_clockwise = false
|
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.
|
# If true, symbol may be used as large background shape in some compositions.
|
||||||
background = false
|
background = false
|
||||||
|
|
|
@ -5,5 +5,6 @@ never_be_nested = true
|
||||||
|
|
||||||
invert_nested = true
|
invert_nested = true
|
||||||
|
|
||||||
|
never_flip_attachments = true
|
||||||
|
|
||||||
attach_to = []
|
attach_to = []
|
|
@ -127,15 +127,19 @@ const AttachedCreatureSymbol: React.FC<AttachedCreatureSymbolProps> = ({
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let xFlip = 1;
|
||||||
|
|
||||||
|
if (!parent.meta?.never_flip_attachments) {
|
||||||
// If we're attaching something oriented towards the left, horizontally flip
|
// If we're attaching something oriented towards the left, horizontally flip
|
||||||
// the attachment image.
|
// the attachment image.
|
||||||
let xFlip = parentAp.normal.x < 0 ? -1 : 1;
|
xFlip = parentAp.normal.x < 0 ? -1 : 1;
|
||||||
|
|
||||||
// Er, things look weird if we don't inverse the flip logic for
|
// Er, things look weird if we don't inverse the flip logic for
|
||||||
// the downward-facing attachments, like legs...
|
// the downward-facing attachments, like legs...
|
||||||
if (parentAp.normal.y > 0) {
|
if (parentAp.normal.y > 0) {
|
||||||
xFlip *= -1;
|
xFlip *= -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const t = getAttachmentTransforms(parentAp, {
|
const t = getAttachmentTransforms(parentAp, {
|
||||||
point: ourAp.point,
|
point: ourAp.point,
|
||||||
|
|
|
@ -30,6 +30,14 @@ type SvgSymbolMetadataBooleans = {
|
||||||
* This changes the rotation direction to clockwise.
|
* This changes the rotation direction to clockwise.
|
||||||
*/
|
*/
|
||||||
rotate_clockwise?: boolean;
|
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([
|
const METADATA_BOOLEANS: Set<keyof SvgSymbolMetadataBooleans> = new Set([
|
||||||
|
@ -38,6 +46,7 @@ const METADATA_BOOLEANS: Set<keyof SvgSymbolMetadataBooleans> = new Set([
|
||||||
"never_be_nested",
|
"never_be_nested",
|
||||||
"invert_nested",
|
"invert_nested",
|
||||||
"rotate_clockwise",
|
"rotate_clockwise",
|
||||||
|
"never_flip_attachments",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function isSvgSymbolMetadataBoolean(
|
function isSvgSymbolMetadataBoolean(
|
||||||
|
|
Ładowanie…
Reference in New Issue