fixes #80 (thanks @LavasSquids)

pull/95/head
dperolio 2 years ago
parent 1af5c9fffe
commit 77213792f4
No known key found for this signature in database
GPG Key ID: 4191689562D51409

@ -8,7 +8,7 @@ import { patch, unpatch } from '@vizality/patcher';
import { getModule } from '@vizality/webpack';
export const labels = [ 'Components', 'Popouts', 'User' ];
export default builtin => {
const UserPopout = getModule(m => m?.type?.displayName === 'UserPopoutContainer');
patch('vz-attributes-popout-user', UserPopout, 'type', (_, res) => {
@ -23,5 +23,30 @@ export default builtin => {
return builtin.error(builtin._labels.concat(labels), err);
}
});
return () => unpatch('vz-attributes-popout-user');
/**
* Fixes user popouts causing the app to sometimes shift up.
* @see {@link https://github.com/lavasquid-vizality/fix-popout}
* @author LavaSquid
* @license MIT
*/
const { layer } = getModule(m => m.layer && m.layerContainer);
const ReferencePositionLayer = getModule(m => m.displayName === 'ReferencePositionLayer');
patch('vz-attributes-popout-user-fix', ReferencePositionLayer.prototype, 'render', (_, res, _this) => {
if (res.props.className !== layer) {
return;
}
if (_this.elementRef.current) {
res.props.style = {
...res.props.style,
..._this.calculateState().style
};
}
});
return () => {
unpatch('vz-attributes-popout-user');
unpatch('vz-attributes-popout-user-fix');
};
};

Loading…
Cancel
Save