Doc2869's Recent Forum Activity

  • I'm not sure what you're trying to achieve - in CSS you can use --construct-scale, and in JavaScript it seems you can use the ILayer property renderScale, which works in both DOM and Worker mode. Doesn't that cover all cases?

    In my previous reply I showed in the screenshot that I need layout scale value in CSS, not in JS. I never had a problem accessing layout scale value in JS.

    Look at the 'background-size' property, where I use both --construct-scale and --layout-scale. First already exists, second currently does not(in CSS), unless you set it yourself by manipulating styles of root DOM element with some JS, which is not possible in worker mode.

  • Does the ILayer renderScale property do what you need?

    Not sure how, it's still a JS scope, right? But I need access to this values from CSS, so that some of my styles html elements could adapt to layout scale, the way they adapt to construct scale thanks to the global --construct-scale variable. This grid class from the screenshot, for example, needs both construct and layout scales to be sized properly.

    I could, of course, just assign new inline css styles through HTMLElement API everytime layout scale changes, but that would be much less convenient.

  • A fundamental limitation of the web platform is web workers can't access the DOM directly. In worker mode Construct runs in a web worker and so there is no direct access to the DOM - internally it works around that with lots of message passing.

    If you write JavaScript code in a project, worker mode "auto" defaults to DOM mode to avoid this problem. If you have set worker mode to "yes" to force running in a worker, but you need to access the DOM, set it back to "auto" or "no".

    So, no way to set this variable in worker mode.

    Have you guys maybe considered to adding this layout scale variable alongside construct scale yourself in some future updates?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I am trying to set a css variable/custom property to root element(document.documentElement), but I guess it's not supported in worker mode.

    I need to a dynamic "--layout-scale" variable, and Construct already sets a similar purposed variable "--construct-scale", so I wondered if there any way for me to access this DOM element without getting errors in worker mode?

  • You do not have permission to view this post

  • You do not have permission to view this post

Doc2869's avatar

Doc2869

Member since 15 Mar, 2015

None one is following Doc2869 yet!

Trophy Case

  • 9-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies