How to do RTL Layout?

Does LightningJS support RTL (right-to-left) rendering settings? I have tried with dir=“rtl”, but it has no impact.

<canvas width="1920" height="1080" id="screen" dir="rtl"></canvas>

How to render with RTL layouts?

Check out - CanvasRenderingContext2D.direction - Web APIs | MDN - Hopefully that solves it.

Hi @chiefcll , Thanks for your reply.

This does work If I am getting the reference of the canvas and drawing manually.

    let canvas = stage.platform.getDrawingCanvas();
    let ctx = canvas.getContext("2d");
    ctx.imageSmoothingEnabled = true;
    ctx.fillStyle = lng.StageUtils.getRgbaString(0xffff0000);
    ctx.fillRect(10, 10, 80, 80);
    ctx.direction = "rtl";
    ctx.fillText("Satadru Bhattacharjee!", 150, 130);

But it does not apply to the templating rendering i.e text etc…, How to enable RTL rending using the lightnings templating?


I don’t see anything built into Lightning to do this. But you’d probably have Lightning create the App and then set the direction on the stage should do it. elm.stage.direction = 'rtl' and then the next text element will get RTL.

Lightning.js doesn’t support RTL.