rdkcentral / Lightning-SDK

SDK for Lightning framework
Apache License 2.0
130 stars 69 forks source link

Img(...).cover stretches image #309

Closed izimuth closed 2 years ago

izimuth commented 2 years ago

The Img(...).cover utility function does not actually produce the CSS cover effect.

See here - https://github.com/rdkcentral/Lightning-SDK/blob/3f46a19d2f2ccbd5c7c6443b98dd5db0d1b8f675/src/Img/index.js#L42

and here - https://github.com/rdkcentral/Lightning-SDK/blob/3f46a19d2f2ccbd5c7c6443b98dd5db0d1b8f675/src/Img/index.js#L84

What happens is the make() function doesn't see the type of 'cover' as valid, and reverts it to 'contain'

This can probably be fixed by using this instead:

if (options.type != 'cover') {      
    if (options.type === 'crop') options.type = 'cover'
    else options.type = 'contain'
}
michielvandergeest commented 2 years ago

Hi @iandeansmith, this should be fixed in PR #316 (which has been merged into dev and will be released soon).

sandeep-vedam commented 2 years ago

This issue is fixed at #316 and is released in version 5.0.0 of SDK