C

Workarounds

This object is a container for all workarounds introduced for different environments.
Inheritance Hierarchy

Remarks

It can be imported like this:
import { Workarounds } from '@yfiles/yfiles';

Workarounds.Ff1729465 = true;

See Also

Developer's Guide

Members

No filters for this type

Constants

Specifies whether repeated key events for modifier keys that are held down should be considered.

If set to true, the input modes perform hit tests upon repeated key events for modifier keys that are held down.

The default value is falsy, as a result, such repeated key events are ignored.

static
Makes sure that no setTimeout(fn,0) calls are "lost" by flushing Dispatcher actions on mouse move (enabled by default).

Symptoms: Starting with Chrome 47, unresponsive GraphComponent during mouse drag, screen updates at ~1 FPS while moving the mouse.

Original cause: setInterval and setTimeout stop during input if timer callbacks are expensive.

Workaround: Make sure that no setTimeout(fn,0) calls are "lost" by flushing Dispatcher actions on mouse move.

This workaround is enabled by default and can be disabled by setting a value < 0. A value > 0 sets the maximum tolerated delay between last dispatcher invoke call and manual flush, e.g. 26 (flush uses requestAnimationFrame).

Workarounds.cr570845 = 24;

More information: Chromium issue

static

See Also

Developer's Guide
Specifies the nonce value to use when inline stylesheets or scripts are appended to the DOM.

If set, inline stylesheets and script tags inserted into the DOM by the library will set the nonce attribute to this value.

This can be used together with loadDefaultCSS to allowlist the yFiles stylesheet when a Content Security Policy is in effect.

The default value is "".

static
Specifies whether WebGL2 rendering mode should use asynchronous, non-blocking, parallel shader compilation if available.

If this is disabled, shader compilation becomes a synchronous, blocking operation, that will take a significant amount of time unless the compiled shaders are already cached by the browser.

The default value is false.

static
Specifies whether the browser's popover API should be omitted when displaying tooltip and context menus.
Prevents calling preventDefault on touch events by early exiting CanvasComponent.maybePreventPointerDefault.

This property is enabled by default in Firefox to support multitouch gestures.

Symptoms: Configuring multi-touch gestures like two-finger panning does not work properly in Firefox.

Original cause: Calling preventDefault on the primary pointer prevents Firefox emitting secondary events.

Workaround: Do not call preventDefault on touch events in Firefox.

This workaround is enabled by default in Firefox.

Workarounds.ff1729465 = true;

More information: Firefox issue

static
Corrects the button state of mouse events if the CTRL modifer is pressed and the values of the MouseEvent.button and MouseEvent.buttons properties don't match.

This property is enabled by default in Firefox on macOS to support snapping overwrite with CTRL modifier.

Symptoms: In Firefox on macOS, CTRL cannot be used to overwrite snapping behavior.

Original cause: Firefox on macOS reports a bogus button event state for left clicks with CTRL modifier.

Workarounds.ff1837973 = true;

More information: Firefox issue

static
Specifies whether the default yFiles stylesheet should be loaded automatically.

If enabled and no yfiles.css was loaded explicitly, the stylesheet is inserted into the head element of the document or into the Web Component's DocumentFragment.

When disabled, it is required to load the yfiles.css stylesheet explicitly.

The default value is true.

static
Optionally provides values to control how mouse wheels behave and are distinguished from trackpad pinches and pans.
You can fine-tune some of these settings to adjust for browser, mouse driver, and hardware inconsistencies.
  • resetTime is the time in milliseconds that can pass between native wheel events before the type of the event will be re-evaluated.
  • mouseWheelThreshold is the value used to discriminate mouse wheel movements from trackpad gestures. Wheel deltas larger than this will be considered mouse wheel events. Set this property to 0 to disable trackpad panning. Mouse wheel events will then always be considered zoom events, even for mouse wheels or mouse drivers that report very small wheel deltas. You can then still use modifiers to pan the canvas with the mouse wheel.
  • mouseWheelMax the maximum value a mouse wheel event should ever have (absolute). This value will clamp the wheel delta value after the correction factor was applied.
  • mouseWheelFactor the correction factor that will be applied to mouse wheel events before passing them on. This will happen before the clamping.
  • trackpadPanMax the maximum value a trackpad panning gesture should ever have (absolute). This value will clamp the wheel delta value after the correction factor was applied.
  • trackpadPanFactor the correction factor that will be applied to trackpad pans before passing them on. This will happen before the clamping.
  • trackpadPinchMax the maximum value a mouse wheel event should ever have (absolute). This value will clamp the wheel delta value after the correction factor was applied.
  • trackpadPinchFactor the correction factor that will be applied to trackpad pans before passing them on. This will happen before the clamping.
static
Specifies whether the shaders used for WebGL2 selection styles should be compiled before they are actually rendered.
The default value is false.
static
Specifies the maximum time interval, in milliseconds, between two taps that causes preventDefault() to be called on the second touchstart event in order to suppress the iOS text-editor loupe.

On iOS, a double tap followed by holding the second tap opens the text-editor loupe. This behavior is unexpected within the GraphComponent, so this workaround calls preventDefault() on the second tap when it occurs within the configured threshold.

For reference, see https://bugs.webkit.org/show_bug.cgi?id=296492 or https://bugs.webkit.org/show_bug.cgi?id=251572. The GraphComponent already uses CSS declarations that are intended to suppress this behavior, but due to the mentioned WebKit regressions, additionally calling preventDefault() is required.

A value of -1 disables this workaround.

The default value is 500 for iOS devices, otherwise -1 (disabled).

static
Specifies the maximum duration in milliseconds of the leave animation of a tooltip.

After this duration, a tooltip is eventually removed from the DOM after the leave animation was triggered.

By default, the tooltip element is automatically removed from the DOM after its CSS transition/animation ended. However, the "animation end" event can fail under rare circumstances such that the element must be removed explicitly.

The leave transition should not take longer than this duration.

The default value is 5000 (5 seconds).

static
Specifies the duration in milliseconds that WebGL2 label rendering is allowed to take in each frame.

The default value is 90 milliseconds.

Labels that are not rendered within the given duration are delayed to the next frame to keep the browser responsive even when loading thousands of labels.

If set to 0, staggered loading of labels is completely disabled and all labels are rendered at once, blocking the browser until completion.

static
Allows passing a createHTML function of a Trusted Types policy for processing the license's watermark.

The library parses the license watermark with parseFromString which is an injection sink and therefore blocked when specifying the CSP require-trusted-types-for 'script'. To resolve this, you can pass your Trusted Types createHTML function here, with which the watermark will be processed before calling parseFromString.

The watermark in the license provided by yWorks can be trusted because it is protected by the license signature. It must not be modified or sanitized by the createHTML function, otherwise the license check will fail.

Example usage:

<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'; trusted-types watermark-policy;"/>
const policy = window.trustedTypes.createPolicy('watermark-policy', {
  createHTML: (input: string) => input // do nothing
})
Workarounds.trustedTypesWatermarkCreateHtml= (input) => policy.createHTML(input)
static