Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
U
uni-pdtravel
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
panyongping
uni-pdtravel
Commits
e310d760
Commit
e310d760
authored
Aug 27, 2024
by
qipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拼图
parent
e492f882
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
photoJigsaw.vue
pages/album/photoJigsaw/photoJigsaw.vue
+6
-4
No files found.
pages/album/photoJigsaw/photoJigsaw.vue
View file @
e310d760
...
@@ -236,7 +236,6 @@ export default {
...
@@ -236,7 +236,6 @@ export default {
promiseArray
=
JSON
.
parse
(
JSON
.
stringify
(
res
[
0
]))
promiseArray
=
JSON
.
parse
(
JSON
.
stringify
(
res
[
0
]))
var
promiseArrayNum
=
promiseArray
[
promiseArray
.
length
-
1
].
top
var
promiseArrayNum
=
promiseArray
[
promiseArray
.
length
-
1
].
top
console
.
log
(
'获取到信息头部:'
,
res
[
0
])
console
.
log
(
'获取到信息头部:'
,
res
[
0
])
console
.
log
(
this
.
screenWidth
)
for
(
let
i
=
0
;
i
<=
promiseArray
.
length
-
1
;
i
++
){
for
(
let
i
=
0
;
i
<=
promiseArray
.
length
-
1
;
i
++
){
if
(
i
==
promiseArray
.
length
-
1
){
//处理背景图
if
(
i
==
promiseArray
.
length
-
1
){
//处理背景图
let
type
=
'image'
let
type
=
'image'
...
@@ -263,11 +262,15 @@ export default {
...
@@ -263,11 +262,15 @@ export default {
let
posX
=
parseInt
(
promiseArray
[
i
].
dataset
.
tailorx
/
606
*
this
.
screenWidth
)
//图片所在画板的X轴数据
let
posX
=
parseInt
(
promiseArray
[
i
].
dataset
.
tailorx
/
606
*
this
.
screenWidth
)
//图片所在画板的X轴数据
let
posY
=
parseInt
(
promiseArray
[
i
].
dataset
.
tailory
/
606
*
this
.
screenWidth
)
//图片所在画板的Y轴数据
let
posY
=
parseInt
(
promiseArray
[
i
].
dataset
.
tailory
/
606
*
this
.
screenWidth
)
//图片所在画板的Y轴数据
//截图的初始X和Y轴
//截图的初始X和Y轴
let
tailorx
=
parseInt
(
promiseArray
[
i
].
dataset
.
tailorx
/
606
*
this
.
screenWidth
)
-
promiseArray
[
i
].
left
//x uni.upx2px(72)+uni.upx2px(promiseArray[i].dataset.tailorx) ---获取左边直至顶部的宽度
let
tailorx
=
(
uni
.
upx2px
(
72
)
+
uni
.
upx2px
(
promiseArray
[
i
].
dataset
.
tailorx
))
-
promiseArray
[
i
].
left
if
(
tailorx
<
0
){
//因为用的parseInt 是直接舍去,当出现负数的时候 则算为0
if
(
tailorx
<
0
){
//因为用的parseInt 是直接舍去,当出现负数的时候 则算为0
tailorx
=
0
tailorx
=
0
}
}
let
tailory
=
parseInt
(
promiseArray
[
i
].
dataset
.
tailory
/
606
*
this
.
screenWidth
)
-
(
promiseArray
[
i
].
top
-
promiseArrayNum
)
//y promiseArrayNum 主边框对顶部的高度 promiseArray[i].dataset.tailory 图片主边框的高度
let
tailory
=
(
promiseArrayNum
+
uni
.
upx2px
(
promiseArray
[
i
].
dataset
.
tailory
))
-
promiseArray
[
i
].
top
+
10
console
.
log
(
promiseArrayNum
+
','
+
uni
.
upx2px
(
promiseArray
[
i
].
dataset
.
tailory
)
+
','
+
promiseArray
[
i
].
top
)
console
.
log
(
tailory
)
if
(
tailory
<
0
){
//因为用的parseInt 是直接舍去,当出现负数的时候 则算为0
if
(
tailory
<
0
){
//因为用的parseInt 是直接舍去,当出现负数的时候 则算为0
tailory
=
0
tailory
=
0
}
}
...
@@ -322,7 +325,6 @@ export default {
...
@@ -322,7 +325,6 @@ export default {
tx
.
onload
=
()
=>
{
tx
.
onload
=
()
=>
{
// 图片 裁剪 :X Y 宽度 高度
// 图片 裁剪 :X Y 宽度 高度
if
(
i
==
promiseArray
.
length
-
1
){
//背景
if
(
i
==
promiseArray
.
length
-
1
){
//背景
console
.
log
(
'123456'
)
textCtx
.
drawImage
(
tx
,
promiseArray
[
i
].
posX
,
promiseArray
[
i
].
posY
,
promiseArray
[
i
].
swidth
,
promiseArray
[
i
].
sheight
)
textCtx
.
drawImage
(
tx
,
promiseArray
[
i
].
posX
,
promiseArray
[
i
].
posY
,
promiseArray
[
i
].
swidth
,
promiseArray
[
i
].
sheight
)
}
else
{
//插入的图片
}
else
{
//插入的图片
//promiseArray[i].tailorx,promiseArray[i].tailory,promiseArray[i].swidth, promiseArray[i].sheight*1.72,
//promiseArray[i].tailorx,promiseArray[i].tailory,promiseArray[i].swidth, promiseArray[i].sheight*1.72,
...
...
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