Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
493e1887
Commit
493e1887
authored
Jan 25, 2021
by
charlie0228
Committed by
GitHub
Jan 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix incorrect image object fit ratio in IE (#19583)
parent
18cf34f7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
packages/image/src/main.vue
packages/image/src/main.vue
+4
-3
No files found.
packages/image/src/main.vue
View file @
493e1887
...
@@ -204,7 +204,8 @@
...
@@ -204,7 +204,8 @@
if
(
!
imageWidth
||
!
imageHeight
||
!
containerWidth
||
!
containerHeight
)
return
{};
if
(
!
imageWidth
||
!
imageHeight
||
!
containerWidth
||
!
containerHeight
)
return
{};
const
vertical
=
imageWidth
/
imageHeight
<
1
;
const
imageAspectRatio
=
imageWidth
/
imageHeight
;
const
containerAspectRatio
=
containerWidth
/
containerHeight
;
if
(
fit
===
ObjectFit
.
SCALE_DOWN
)
{
if
(
fit
===
ObjectFit
.
SCALE_DOWN
)
{
const
isSmaller
=
imageWidth
<
containerWidth
&&
imageHeight
<
containerHeight
;
const
isSmaller
=
imageWidth
<
containerWidth
&&
imageHeight
<
containerHeight
;
...
@@ -215,9 +216,9 @@
...
@@ -215,9 +216,9 @@
case
ObjectFit
.
NONE
:
case
ObjectFit
.
NONE
:
return
{
width
:
'
auto
'
,
height
:
'
auto
'
};
return
{
width
:
'
auto
'
,
height
:
'
auto
'
};
case
ObjectFit
.
CONTAIN
:
case
ObjectFit
.
CONTAIN
:
return
vertical
?
{
width
:
'
auto
'
}
:
{
height
:
'
auto
'
};
return
(
imageAspectRatio
<
containerAspectRatio
)
?
{
width
:
'
auto
'
}
:
{
height
:
'
auto
'
};
case
ObjectFit
.
COVER
:
case
ObjectFit
.
COVER
:
return
vertical
?
{
height
:
'
auto
'
}
:
{
width
:
'
auto
'
};
return
(
imageAspectRatio
<
containerAspectRatio
)
?
{
height
:
'
auto
'
}
:
{
width
:
'
auto
'
};
default
:
default
:
return
{};
return
{};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment