Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
pptist
Commits
7ce82819
Commit
7ce82819
authored
Dec 07, 2023
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
替换图片调整
parent
268b4666
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
UploadPicture.vue
src/views/Editor/CanvasTool/UploadPicture.vue
+35
-1
No files found.
src/views/Editor/CanvasTool/UploadPicture.vue
View file @
7ce82819
...
...
@@ -110,6 +110,8 @@ import { getImageDataURL } from '@/utils/image'
import
{
useMainStore
,
useSlidesStore
,
useScreenStore
}
from
'@/store'
import
{
injectKeyDataSource
}
from
'@/types/injectKey'
import
ConfigService
from
'@/services/ConfigService'
import
{
VIEWPORT_SIZE
,
VIEWPORT_VER_SIZE
}
from
'@/configs/canvas'
import
FileService
from
'@/services/FileService'
import
FileInput
from
'@/components/FileInput.vue'
const
showVisible
=
ref
(
true
)
...
...
@@ -151,6 +153,7 @@ const mainStore = useMainStore()
const
{
createImageElement
}
=
useCreateElement
()
const
{
addHistorySnapshot
}
=
useHistorySnapshot
()
const
slidesStore
=
useSlidesStore
()
const
{
slides
,
currentSlide
,
slideIndex
,
layoutSlides
}
=
storeToRefs
(
slidesStore
)
const
{
handleElement
,
handleElementId
}
=
storeToRefs
(
mainStore
)
const
handleSizeChange
=
(
val
:
number
)
=>
{
...
...
@@ -171,7 +174,7 @@ const insertImageElement = (files: FileList) => {
})
}
const
setImgs
=
()
=>
{
const
setImgs
=
async
()
=>
{
let
text
=
'请选择图片'
let
url
=
imgOnline
.
value
if
(
activeName
.
value
==
'1'
)
propsDatas
.
value
=
{
src
:
imgOnline
.
value
}
...
...
@@ -196,6 +199,37 @@ const setImgs = () => {
close
()
}
if
(
imgType
.
value
==
2
){
const
slidesData
=
slides
.
value
for
(
let
index
=
0
;
index
<
slidesData
.
length
;
index
++
)
{
const
x
=
slidesData
[
index
]
as
any
;
for
(
let
j
=
0
;
j
<
x
.
elements
.
length
;
j
++
)
{
const
y
=
x
.
elements
[
j
];
if
(
slideIndex
.
value
==
index
&&
y
.
id
==
handleElementId
.
value
){
let
maxWidth
=
VIEWPORT_SIZE
,
maxHeight
=
VIEWPORT_VER_SIZE
,
viewportRatio
=
slidesStore
.
viewportRatio
if
(
viewportRatio
<
1
){
maxWidth
=
VIEWPORT_VER_SIZE
maxHeight
=
VIEWPORT_SIZE
}
let
tempSize
=
await
FileService
.
getImageSizeWithoutDownloading
(
propsDatas
.
value
.
src
)
if
(
tempSize
.
width
>
maxWidth
){
let
ratio
=
maxWidth
/
tempSize
.
width
tempSize
.
width
=
maxWidth
tempSize
.
height
=
tempSize
.
height
*
ratio
}
if
(
tempSize
.
height
>
maxHeight
){
let
ratio
=
maxHeight
/
tempSize
.
height
tempSize
.
height
=
maxHeight
tempSize
.
width
=
tempSize
.
width
*
ratio
}
if
(
y
.
left
<
0
)
y
.
left
=
0
if
(
y
.
top
<
0
)
y
.
top
=
0
y
.
width
=
tempSize
.
width
y
.
height
=
tempSize
.
height
y
.
src
=
propsDatas
.
value
.
src
y
.
fixedRatio
=
true
}
}
}
slidesStore
.
updateElement
({
id
:
handleElementId
.
value
,
props
:
propsDatas
.
value
})
addHistorySnapshot
()
close
()
...
...
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