0

I am using strokeScaleEnabled=false to disable stroke width scaling. However shadow offset is still scaling when I scale stage. I see no "shadowOffsetScaleEnabled" property to disable shadow offset scaling.

Is there any other API or I must re-calculate shadowOffset values based on stage scale?

EGL 2-101
  • 1,203
  • 8
  • 17

1 Answers1

1

Currently with konva@4.1.5 there is no API for disabling shadow offset scaling.

So you have to reset it manually. With something like:

const OFFSET = 5;

shape.shadowOffsetX(OFFSET / stage.scaleX());
shape.shadowOffsetY(OFFSET / stage.scaleY());

Demo: https://jsbin.com/bikiwedero/1/edit?js,output

lavrton
  • 18,973
  • 4
  • 30
  • 63
  • Thanks. I finally did the same. I hope we can have two different layers and apply the scaling to layers instead of stage. So, application chrome can alway be at scale=1. is that possible? – EGL 2-101 Mar 02 '20 at 07:14
  • 1
    something like this: `shape.shadowOffsetX(OFFSET / shape.getAbsoluteScale().x);` – lavrton Mar 02 '20 at 22:10