Skip to content

Commit 5263804

Browse files
committed
Add flipx and flipy to the glyph schema
1 parent cc5cd72 commit 5263804

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/renderers/_base.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,15 @@ export abstract class RendererBase {
778778
size = factor * cellsize;
779779
}
780780

781+
// flip if requested
782+
// (svg.js seems to be doing it opposite of what I expect)
783+
if (g.flipx !== undefined && g.flipx) {
784+
use.flip("y");
785+
}
786+
if (g.flipy !== undefined && g.flipy) {
787+
use.flip("x");
788+
}
789+
781790
// Shift if requested
782791
if (g.nudge !== undefined) {
783792
let dx = 0;

src/schemas/schema.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ export interface Glyph {
327327
* Determines how the piece (usually a text element) is reorientated after rotation is done. 'vertical' means it will always be reorientated vertically. Otherwise, it rotates along with everything else.
328328
*/
329329
orientation?: "vertical" | "fluid";
330+
/**
331+
* Flips the glyph across the x axis
332+
*/
333+
flipx?: boolean;
334+
/**
335+
* Flips the glyph across the y axis
336+
*/
337+
flipy?: boolean;
330338
/**
331339
* The number of units to nudge the glyph from centre.
332340
*/

src/schemas/schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@
311311
"enum": ["vertical", "fluid"],
312312
"default": "fluid"
313313
},
314+
"flipx": {
315+
"description": "Flips the glyph across the x axis",
316+
"type": "boolean",
317+
"default": false
318+
},
319+
"flipy": {
320+
"description": "Flips the glyph across the y axis",
321+
"type": "boolean",
322+
"default": false
323+
},
314324
"nudge" : {
315325
"description": "The number of units to nudge the glyph from centre.",
316326
"type": "object",

0 commit comments

Comments
 (0)