Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
47bf5707
Commit
47bf5707
authored
Jul 02, 2021
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:处理图片裁剪
parent
9f892188
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
src/components/ImgClipModal.jsx
+16
-3
No files found.
src/components/ImgClipModal.jsx
View file @
47bf5707
...
@@ -87,8 +87,9 @@ class ImgClipModal extends React.Component {
...
@@ -87,8 +87,9 @@ class ImgClipModal extends React.Component {
autoCropArea=
{
1
}
autoCropArea=
{
1
}
checkOrientation=
{
false
}
checkOrientation=
{
false
}
cropBoxResizable=
{
false
}
cropBoxResizable=
{
false
}
minCropBoxWidth=
{
cropBoxWidth
}
center=
{
true
}
minCropBoxHeight=
{
cropBoxHeight
}
// minCropBoxWidth={cropBoxWidth}
// minCropBoxHeight={cropBoxHeight}
cropBoxMovable=
{
false
}
cropBoxMovable=
{
false
}
dragMode=
'move'
dragMode=
'move'
onInitialized=
{
(
instance
)
=>
{
onInitialized=
{
(
instance
)
=>
{
...
@@ -100,9 +101,21 @@ class ImgClipModal extends React.Component {
...
@@ -100,9 +101,21 @@ class ImgClipModal extends React.Component {
this
.
setState
({
this
.
setState
({
hasImgReady
:
true
hasImgReady
:
true
})
})
this
.
state
.
cropperInstace
.
setCropBoxData
({
width
:
Number
(
cropBoxWidth
),
height
:
Number
(
cropBoxHeight
)});
this
.
state
.
cropperInstace
.
setCropBoxData
({
width
:
Number
(
cropBoxWidth
),
height
:
Number
(
cropBoxHeight
),
top
:(
215
-
cropBoxHeight
/
2
)});
console
.
log
(
"height++++"
,
this
.
state
.
cropperInstace
.
getImageData
().
height
);
console
.
log
(
"width++++"
,
this
.
state
.
cropperInstace
.
getImageData
().
width
);
const
ratio
=
(
this
.
state
.
cropperInstace
.
getImageData
().
width
/
2
)
/
500
;
console
.
log
(
"ratio++++"
,
ratio
);
this
.
state
.
cropperInstace
.
setCanvasData
({
width
:
500
});
this
.
state
.
cropperInstace
.
setCanvasData
({
width
:
500
});
const
that
=
this
;
const
that
=
this
;
// const containerData = this.state.cropperInstace.getContainerData();
// // Zoom to 50% from the center of the container.
// this.state.cropperInstace.zoomTo(.5,
{
// x: containerData.width / 2,
// y: containerData.height / 2,
//
});
document
.
querySelector
(
'.cropper__box'
).
addEventListener
(
'dblclick'
,
function
(
e
)
{
document
.
querySelector
(
'.cropper__box'
).
addEventListener
(
'dblclick'
,
function
(
e
)
{
that
.
state
.
cropperInstace
.
rotate
(
90
)
that
.
state
.
cropperInstace
.
rotate
(
90
)
});
});
...
...
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