mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Performance optimization: Prevent pixi from rendering if any dialog is opened (#4415)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
export const aboveMaterialUiMaxZIndex = 1501; // highest z-index used by MaterialUI is 1500
|
||||
import { aboveMaterialUiMaxZIndex } from '../UI/MaterialUISpecificUtil';
|
||||
|
||||
const getStyleAttribute = (element: Element, prop: string) =>
|
||||
getComputedStyle(element).getPropertyValue(prop);
|
||||
|
@@ -3,14 +3,11 @@ import * as React from 'react';
|
||||
import Rectangle from '../Utils/Rectangle';
|
||||
import useOnResize from '../Utils/UseOnResize';
|
||||
import useForceUpdate from '../Utils/UseForceUpdate';
|
||||
import {
|
||||
aboveMaterialUiMaxZIndex,
|
||||
getDisplayZIndexForHighlighter,
|
||||
getScrollParent,
|
||||
} from './HTMLUtils';
|
||||
import { getDisplayZIndexForHighlighter, getScrollParent } from './HTMLUtils';
|
||||
import ArrowTop from '../UI/CustomSvgIcons/ArrowTop';
|
||||
import ArrowBottom from '../UI/CustomSvgIcons/ArrowBottom';
|
||||
import useIsElementVisibleInScroll from '../Utils/UseIsElementVisibleInScroll';
|
||||
import { aboveMaterialUiMaxZIndex } from '../UI/MaterialUISpecificUtil';
|
||||
|
||||
type Props = {|
|
||||
element: HTMLElement,
|
||||
|
@@ -32,6 +32,7 @@ import InstancesSelection from './InstancesSelection';
|
||||
import LongTouchHandler from './LongTouchHandler';
|
||||
import { type InstancesEditorSettings } from './InstancesEditorSettings';
|
||||
import Rectangle from '../Utils/Rectangle';
|
||||
import { isNoDialogOpened } from '../UI/MaterialUISpecificUtil';
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
const styles = {
|
||||
@@ -926,7 +927,7 @@ export default class InstancesEditor extends Component<Props> {
|
||||
if (this._renderingPaused) return;
|
||||
|
||||
// Avoid killing the CPU by limiting the rendering calls.
|
||||
if (this.fpsLimiter.shouldUpdate()) {
|
||||
if (this.fpsLimiter.shouldUpdate() && isNoDialogOpened()) {
|
||||
this.backgroundColor.render();
|
||||
this.viewPosition.render();
|
||||
this.canvasCursor.render();
|
||||
|
8
newIDE/app/src/UI/MaterialUISpecificUtil.js
Normal file
8
newIDE/app/src/UI/MaterialUISpecificUtil.js
Normal file
@@ -0,0 +1,8 @@
|
||||
// @flow
|
||||
export const aboveMaterialUiMaxZIndex = 1501; // highest z-index used by MaterialUI is 1500
|
||||
|
||||
export const isNoDialogOpened = (): boolean => {
|
||||
return !document.querySelector(
|
||||
'body > div[role="presentation"].MuiDialog-root'
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user