strange x value when call setData
Closed this issue · 1 comments
zhouSir340 commented
Describe the bug
using vue3 and encapsulate cropper into a component, calling setData after init, the response'x value is -1.8989449817236961e-13
To Reproduce
Steps to reproduce the behavior:
- using vue3, using MyComponent, the image is base64
<MyComponent v-if="img" :image="img" style="width: 800px" />
- MyComponent will init cropper when mounted, and the options is like below:
new Cropper(img.value, {
background: false,
guides: false,
movable: false,
viewMode: 2,
dragMode: 'move',
autoCropArea: 1,
modal: false,
scalable: false,
zoomable: false,
cropBoxMovable: false,
});
};
- calling setData func, the response is:
{x: -1.8989449817236961e-13,
y: 0,
width: 2688,
height: 1520,
rotate: 0}
- Then I pulled the drag line on the left back and forth, call the setData, the response's x value is become normal 0
Expected behavior
the x value of setData'response should be correct after init
Desktop (please complete the following information):
- OS: [windows11]
- Browser [edge]
- Version [126.0.2592.113 ]
Additional context
fengyuanchen commented
Only viewMode: 0
supports your case.