Use naturalWidth and naturalHeight for image data
PiperOrigin-RevId: 491694147
This commit is contained in:
parent
c8a413bb4e
commit
09740130e8
|
@ -325,6 +325,10 @@ export class GraphRunner {
|
||||||
if ((imageSource as HTMLVideoElement).videoWidth) {
|
if ((imageSource as HTMLVideoElement).videoWidth) {
|
||||||
width = (imageSource as HTMLVideoElement).videoWidth;
|
width = (imageSource as HTMLVideoElement).videoWidth;
|
||||||
height = (imageSource as HTMLVideoElement).videoHeight;
|
height = (imageSource as HTMLVideoElement).videoHeight;
|
||||||
|
} else if ((imageSource as HTMLImageElement).naturalWidth) {
|
||||||
|
// TODO: Ensure this works with SVG images
|
||||||
|
width = (imageSource as HTMLImageElement).naturalWidth;
|
||||||
|
height = (imageSource as HTMLImageElement).naturalHeight;
|
||||||
} else {
|
} else {
|
||||||
width = imageSource.width;
|
width = imageSource.width;
|
||||||
height = imageSource.height;
|
height = imageSource.height;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user