Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - image / container border pushes image instead of it resizing automaticly #1179

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions packages/gallery/src/components/item/imageItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ImageItem extends React.Component {
}

getImageContainer(imageRenderer, classNames, extraNodes) {
const { imageDimensions, id, actions } = this.props;
const { id, actions } = this.props;

return (
<div
Expand All @@ -68,7 +68,7 @@ class ImageItem extends React.Component {
onTouchEnd={actions.handleItemMouseUp}
key={'image_container-' + id}
data-hook={'image-item'}
style={imageDimensions}
style={{ boxSizing: 'border-box' }}
>
{imageRenderer()}
{extraNodes}
Expand Down Expand Up @@ -115,7 +115,7 @@ class ImageItem extends React.Component {
settings && settings.imageProps && typeof settings.imageProps === 'function' ? settings.imageProps(id) : {};

// eslint-disable-next-line no-unused-vars
const { marginLeft, marginTop, ...imageSizing } = imageDimensions;
const { marginLeft, marginTop } = imageDimensions;

const image = () => {
const imagesComponents = [];
Expand Down Expand Up @@ -150,7 +150,6 @@ class ImageItem extends React.Component {
key={'image_preload_blur-' + id}
src={createUrl(GALLERY_CONSTS.urlSizes.RESIZED, GALLERY_CONSTS.urlTypes.LOW_RES)}
style={{
...imageSizing,
...preloadStyles,
...blockDownloadStyles,
}}
Expand All @@ -166,7 +165,6 @@ class ImageItem extends React.Component {
key={'image_preload_main_color-' + id}
src={createUrl(GALLERY_CONSTS.urlSizes.PIXEL, GALLERY_CONSTS.urlTypes.HIGH_RES)}
style={{
...imageSizing,
...preloadStyles,
...blockDownloadStyles,
}}
Expand Down Expand Up @@ -199,7 +197,6 @@ class ImageItem extends React.Component {
onLoad={this.handleHighResImageLoad}
loading={this.props.isPrerenderMode ? 'lazy' : 'eager'}
style={{
...imageSizing,
...blockDownloadStyles,
...(!shouldRenderHighResImages && preloadStyles),
}}
Expand Down
5 changes: 1 addition & 4 deletions packages/gallery/src/components/item/itemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ class ItemView extends React.Component {

getItemWrapperStyles() {
const { createUrl, options, style, type, offset } = this.props;
const { height, width, innerWidth, innerHeight } = style;
const { innerTop, innerLeft } = offset;
let styles = {};
if (type === 'text') {
Expand All @@ -732,7 +731,6 @@ class ItemView extends React.Component {
styles = {
...styles,
background: `url(${createUrl(GALLERY_CONSTS.urlSizes.PIXEL, GALLERY_CONSTS.urlTypes.HIGH_RES)})`,
backgroundSize: `${innerWidth}px ${innerHeight}px`,
backgroundRepeat: 'no-repeat',
backgroundPosition: `top ${innerTop}px left ${innerLeft}px`,
};
Expand All @@ -741,8 +739,6 @@ class ItemView extends React.Component {
if (options[optionsMap.behaviourParams.item.content.hoverAnimation] === TILT) {
styles['--tiltAngleValue'] = options[optionsMap.behaviourParams.item.content.tiltAngleValue];
}
styles.height = height + 'px';
styles.width = width + 'px';
styles.margin = -options[optionsMap.stylingParams.itemBorderWidth] + 'px';

return styles;
Expand Down Expand Up @@ -974,6 +970,7 @@ class ItemView extends React.Component {
this.props.options[optionsMap.layoutParams.info.placement],
this.props.idx
) && { float: 'right' }),
height: '100%',
}}
>
{!isItemWrapperEmpty && (
Expand Down
Loading