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
e5b75d17
Commit
e5b75d17
authored
Sep 26, 2024
by
qipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片旋转
parent
de614072
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
photoJigsaw.vue
pages/album/photoJigsaw/photoJigsaw.vue
+22
-3
No files found.
pages/album/photoJigsaw/photoJigsaw.vue
View file @
e5b75d17
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<view
class=
"jigsaw-picture"
data-type=
"view"
id=
"jigsawPicture"
ref=
"jigsawPicture"
v-if=
"textCanvasType==true"
>
<view
class=
"jigsaw-picture"
data-type=
"view"
id=
"jigsawPicture"
ref=
"jigsawPicture"
v-if=
"textCanvasType==true"
>
<template
v-for=
"(item,index) in pictureJigsawPosition"
>
<template
v-for=
"(item,index) in pictureJigsawPosition"
>
<view
class=
"picture-position"
@
scroll=
"onScroll($event,index)"
:key=
"index"
:style=
"
{'width': item.width + 'rpx' ,'height': item.height + 'rpx' ,'top': item.top + 'rpx' ,'left': item.left + 'rpx' ,'border-radius': item.radius + 'rpx' ,}">
<view
class=
"picture-position"
:class=
"photoNewNum==index?'photoNewStye':''"
@
scroll=
"onScroll($event,index)"
:key=
"index"
:style=
"
{'width': item.width + 'rpx' ,'height': item.height + 'rpx' ,'top': item.top + 'rpx' ,'left': item.left + 'rpx' ,'border-radius': item.radius + 'rpx' ,}">
<movable-area
scale-area
:style=
"
{'width': item.width + 'rpx' ,'height': item.height + 'rpx'}">
<movable-area
scale-area
:style=
"
{'width': item.width + 'rpx' ,'height': item.height + 'rpx'}">
<!--scale-min最小倍数 scale-max最大倍数 scale-value每次放大缩小倍数 image需要和movable-view大小一致-->
<!--scale-min最小倍数 scale-max最大倍数 scale-value每次放大缩小倍数 image需要和movable-view大小一致-->
<movable-view
direction=
"all"
@
scale=
"onScale"
scale=
"true"
scale-min=
"0"
scale-max=
"4"
:scale-value=
"1"
:style=
"
{width:item.realTimeWidth+'px',height:item.realTimeHeight+'px'}">
<movable-view
direction=
"all"
@
scale=
"onScale"
scale=
"true"
scale-min=
"0"
scale-max=
"4"
:scale-value=
"1"
:style=
"
{width:item.realTimeWidth+'px',height:item.realTimeHeight+'px'}">
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
:data-tailorx=
"item.left"
:data-tailory=
"item.top"
:data-id=
"item.id"
:data-tailorx=
"item.left"
:data-tailory=
"item.top"
:data-id=
"item.id"
:data-primitiveWidth=
"item.primitiveWidth"
:data-primitiveHeight=
"item.primitiveHeight"
:data-primitiveWidth=
"item.primitiveWidth"
:data-primitiveHeight=
"item.primitiveHeight"
:class=
"item.id"
:class=
"item.id"
:style=
"
{width:item.realTimeWidth+'px',height:item.realTimeHeight+'px',transform:
rotate(item.transform+'deg')
}"
:style=
"
{width:item.realTimeWidth+'px',height:item.realTimeHeight+'px',transform:
'rotate('+item.transform+'deg)'
}"
@touchstart="handleTouchStart($event,index)" @touchmove="handleTouchMove($event,index)" @touchend="handleTouchEnd($event,index)">
</image>
@touchstart="handleTouchStart($event,index)" @touchmove="handleTouchMove($event,index)" @touchend="handleTouchEnd($event,index)">
</image>
</movable-view>
</movable-view>
</movable-area>
</movable-area>
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
<image
src=
"../static/album/photoCheck02.png"
></image>
<image
src=
"../static/album/photoCheck02.png"
></image>
<view>
替换
</view>
<view>
替换
</view>
</view>
</view>
<view
class=
"btn-list"
>
<view
class=
"btn-list"
@
click=
"rotateFun()"
>
<image
src=
"../static/album/photoCheck03.png"
></image>
<image
src=
"../static/album/photoCheck03.png"
></image>
<view>
旋转90°
</view>
<view>
旋转90°
</view>
</view>
</view>
...
@@ -178,6 +178,8 @@ export default {
...
@@ -178,6 +178,8 @@ export default {
textCanvasType
:
true
,
//临时控制画布显隐
textCanvasType
:
true
,
//临时控制画布显隐
bottomCheckType
:
false
,
//控制脚部按钮切换
bottomCheckType
:
false
,
//控制脚部按钮切换
photoNewNum
:
0
,
//当前选择的是第几张图片
}
}
},
},
onLoad
(
option
)
{
onLoad
(
option
)
{
...
@@ -190,6 +192,18 @@ export default {
...
@@ -190,6 +192,18 @@ export default {
this
.
lodaImgFun
()
this
.
lodaImgFun
()
},
},
methods
:
{
methods
:
{
rotateFun
(){
//旋转90°
var
rotateNum
=
this
.
pictureJigsawPosition
[
this
.
photoNewNum
].
transform
if
(
rotateNum
==
0
){
this
.
pictureJigsawPosition
[
this
.
photoNewNum
].
transform
=
90
}
else
if
(
rotateNum
==
90
){
this
.
pictureJigsawPosition
[
this
.
photoNewNum
].
transform
=
180
}
else
if
(
rotateNum
==
180
){
this
.
pictureJigsawPosition
[
this
.
photoNewNum
].
transform
=
270
}
else
if
(
rotateNum
==
270
){
this
.
pictureJigsawPosition
[
this
.
photoNewNum
].
transform
=
0
}
},
lodaImgFun
(){
//获取图片
lodaImgFun
(){
//获取图片
this
.
pictureJigsawPosition
.
forEach
((
item
,
index
)
=>
{
this
.
pictureJigsawPosition
.
forEach
((
item
,
index
)
=>
{
uni
.
getImageInfo
({
uni
.
getImageInfo
({
...
@@ -232,6 +246,7 @@ export default {
...
@@ -232,6 +246,7 @@ export default {
handleTouchMove
(
event
,
index
)
{
handleTouchMove
(
event
,
index
)
{
},
},
handleTouchStart
(
event
,
index
)
{
//changedTouches[0] pageX横向 pageY属相 //rect (top, right, bottom, left)
handleTouchStart
(
event
,
index
)
{
//changedTouches[0] pageX横向 pageY属相 //rect (top, right, bottom, left)
this
.
photoNewNum
=
index
this
.
transpositionStartMes
=
event
.
changedTouches
[
0
]
this
.
transpositionStartMes
=
event
.
changedTouches
[
0
]
this
.
transpositionStartIndex
=
index
this
.
transpositionStartIndex
=
index
},
},
...
@@ -442,6 +457,10 @@ export default {
...
@@ -442,6 +457,10 @@ export default {
top
:
0
;
top
:
0
;
left
:
0
;
left
:
0
;
}
}
.photoNewStye
{
border
:
solid
2px
green
;
box-sizing
:
content-box
;
}
/
deep
/
movable-view
{
/
deep
/
movable-view
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
...
...
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