etr2460 commented on a change in pull request #7772: Reuse SVG node
URL:
https://github.com/apache/incubator-superset/pull/7772#discussion_r297295665
##########
File path: superset/assets/src/components/FilterableTable/FilterableTable.jsx
##########
@@ -29,16 +29,18 @@ import {
SortIndicator,
Table,
} from 'react-virtualized';
-import { getTextDimension } from '@superset-ui/dimension';
+import { createSVGNode, getTextDimension } from '@superset-ui/dimension';
import { t } from '@superset-ui/translation';
import Button from '../Button';
import CopyToClipboard from '../CopyToClipboard';
import ModalTrigger from '../ModalTrigger';
import TooltipWrapper from '../TooltipWrapper';
+const svg = createSVGNode({ container: document.body });
+
function getTextWidth(text, font = '12px Roboto') {
- return getTextDimension({ text, style: { font } }).width;
+ return getTextDimension({ text, style: { font }, existingSVGNode: svg
}).width;
Review comment:
Check out my comment here:
https://github.com/apache-superset/superset-ui/pull/173/files#r297294252 but I
don't think this actually applies the font to the text here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]