fix(zhst/meta-cropperImage): cropperImage 透出矩形坐标
This commit is contained in:
parent
f9fd6389c4
commit
defd87dfc7
@ -1,6 +1,40 @@
|
||||
# @zhst/biz
|
||||
|
||||
## 0.19.2
|
||||
## 0.21.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/meta@0.20.0
|
||||
|
||||
## 0.21.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.13.0
|
||||
- @zhst/func@0.15.0
|
||||
- @zhst/icon@0.5.0
|
||||
- @zhst/meta@0.19.0
|
||||
|
||||
## 0.20.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.1
|
||||
- @zhst/hooks@0.12.1
|
||||
- @zhst/meta@0.18.1
|
||||
|
||||
## 0.20.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 重新发版
|
||||
|
||||
### Patch Changes
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/biz",
|
||||
"version": "0.19.2",
|
||||
"version": "0.21.1",
|
||||
"description": "业务库",
|
||||
"keywords": [
|
||||
"business",
|
||||
|
@ -1,5 +1,23 @@
|
||||
# @zhst/utils
|
||||
|
||||
## 0.15.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/request@0.15.0
|
||||
|
||||
## 0.14.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- zhst/func: 修改 pxToRem 算法
|
||||
- @zhst/request@0.14.1
|
||||
|
||||
## 0.14.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -79,7 +79,7 @@ export var getValueByUrl = function getValueByUrl(key, str) {
|
||||
* @param rootFontSize 根元素大小: 默认16px
|
||||
*/
|
||||
export var pxToRem = function pxToRem(value, rootFontSize) {
|
||||
var fontSize = rootFontSize || parseFloat(document.documentElement.style.fontSize) || 16;
|
||||
var fontSize = rootFontSize || 80 || parseFloat(document.documentElement.style.fontSize);
|
||||
var valueArr = value.split(' ');
|
||||
return valueArr.filter(function (o) {
|
||||
return o;
|
||||
|
@ -76,7 +76,7 @@ var getValueByUrl = (key, str) => {
|
||||
return result;
|
||||
};
|
||||
var pxToRem = (value, rootFontSize) => {
|
||||
const fontSize = rootFontSize || parseFloat(document.documentElement.style.fontSize) || 16;
|
||||
const fontSize = rootFontSize || 80;
|
||||
const valueArr = value.split(" ");
|
||||
return valueArr.filter((o) => o).map((val) => parseFloat(val) / fontSize + "rem").join(" ");
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/func",
|
||||
"version": "0.14.0",
|
||||
"version": "0.15.0",
|
||||
"description": "函数合集",
|
||||
"keywords": [
|
||||
"hooks"
|
||||
|
@ -85,7 +85,7 @@ export const getValueByUrl = (key: string, str: string) => {
|
||||
* @param rootFontSize 根元素大小: 默认16px
|
||||
*/
|
||||
export const pxToRem = (value: string, rootFontSize?: number) => {
|
||||
const fontSize = rootFontSize || parseFloat(document.documentElement.style.fontSize) || 16
|
||||
const fontSize = rootFontSize || 80 || parseFloat(document.documentElement.style.fontSize)
|
||||
const valueArr = value.split(' ')
|
||||
|
||||
return valueArr.filter(o => o).map(val => ((parseFloat(val) / fontSize) + 'rem')).join(' ')
|
||||
|
@ -1,5 +1,23 @@
|
||||
# @zhst/hooks
|
||||
|
||||
## 0.13.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.15.0
|
||||
|
||||
## 0.12.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.1
|
||||
|
||||
## 0.12.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/hooks",
|
||||
"version": "0.12.0",
|
||||
"version": "0.13.0",
|
||||
"description": "hooks合集",
|
||||
"keywords": [
|
||||
"hooks"
|
||||
|
@ -1,5 +1,11 @@
|
||||
# @zhst/icon
|
||||
|
||||
## 0.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
## 0.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/icon",
|
||||
"version": "0.4.0",
|
||||
"version": "0.5.0",
|
||||
"description": "图标库",
|
||||
"keywords": [
|
||||
"icon",
|
||||
|
@ -1,6 +1,42 @@
|
||||
# @zhst/material
|
||||
|
||||
## 0.14.2
|
||||
## 0.17.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- fix: cropperImage 透出矩形坐标
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/meta@0.20.0
|
||||
- @zhst/biz@0.21.1
|
||||
|
||||
## 0.16.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.13.0
|
||||
- @zhst/func@0.15.0
|
||||
- @zhst/meta@0.19.0
|
||||
- @zhst/biz@0.21.0
|
||||
|
||||
## 0.15.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.1
|
||||
- @zhst/biz@0.20.1
|
||||
- @zhst/hooks@0.12.1
|
||||
- @zhst/meta@0.18.1
|
||||
|
||||
## 0.15.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/material",
|
||||
"version": "0.14.2",
|
||||
"version": "0.17.0",
|
||||
"description": "物料库",
|
||||
"keywords": [
|
||||
"business",
|
||||
|
@ -1,5 +1,39 @@
|
||||
# @zhst/utils
|
||||
|
||||
## 0.20.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- fix: cropperImage 透出矩形坐标
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/meta@0.20.0
|
||||
|
||||
## 0.19.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.13.0
|
||||
- @zhst/func@0.15.0
|
||||
- @zhst/icon@0.5.0
|
||||
- @zhst/meta@0.19.0
|
||||
|
||||
## 0.18.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.1
|
||||
- @zhst/hooks@0.12.1
|
||||
- @zhst/meta@0.18.1
|
||||
|
||||
## 0.18.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/meta",
|
||||
"version": "0.18.0",
|
||||
"version": "0.20.0",
|
||||
"description": "原子组件",
|
||||
"keywords": [
|
||||
"meta",
|
||||
|
@ -212,7 +212,6 @@ export const getOtherExtendRect = (srcRect: Rect, maxW: number, maxH: number, ty
|
||||
return newRect;
|
||||
};
|
||||
|
||||
|
||||
export const getTransformRect = (image: { height: number; width: number; }, transform: { translateX: any; translateY: any; scale: any; rotate: any; }, rect: Rect) => {
|
||||
const canvasRect = {
|
||||
x: rect.x,
|
||||
|
@ -9,6 +9,7 @@ import { Cropper, EVENT_CROP_END, EVENT_CROP_START, EVENT_SHAPE_SELECT } from '.
|
||||
import { Rect } from '../ImageEditor/viewer/shape';
|
||||
import { checkPointInRect, drawArrowLine, getImageDataByPosition, percentToLength } from './cropperImagehelper';
|
||||
import Align from 'rc-align';
|
||||
import { getTransformRect } from '../BigImagePreview/bigImagePreviewHelper';
|
||||
|
||||
interface RectPro extends Rect {
|
||||
imageRect: string
|
||||
@ -161,8 +162,10 @@ const CropperImage = forwardRef<CropperImageRefProps, CropperImageProps>((props,
|
||||
// 矩形 - 结束绘制实践
|
||||
cropEndRef.current = addEventListenerWrapper(imageRef.current, EVENT_CROP_END, (event: { detail: any; }) => {
|
||||
const data = event.detail;
|
||||
const imageRect = getImageDataByPosition({ x: data.left, y: data.top, w: data.width, h: data.height }, { canvas: viewerRef.current.canvas })
|
||||
onCropEnd?.({ ...data , imageRect, targetTransform })
|
||||
const targetPosition = { x: data.left, y: data.top, w: data.width, h: data.height }
|
||||
const imageRect = getImageDataByPosition(targetPosition, { canvas: viewerRef.current.canvas })
|
||||
const targetData = getTransformRect(_viewer.image, targetTransform, targetPosition)
|
||||
onCropEnd?.({ ...data , imageRect, targetTransform, targetData })
|
||||
setIsMove(false)
|
||||
})
|
||||
} else {
|
||||
|
@ -1,5 +1,23 @@
|
||||
# @zhst/request
|
||||
|
||||
## 0.15.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.15.0
|
||||
|
||||
## 0.14.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.1
|
||||
|
||||
## 0.14.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/request",
|
||||
"version": "0.14.0",
|
||||
"version": "0.15.0",
|
||||
"description": "请求库",
|
||||
"keywords": [
|
||||
"request",
|
||||
|
@ -1,5 +1,23 @@
|
||||
# @zhst/slave
|
||||
|
||||
## 0.11.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 修复之前发版错乱问题
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.15.0
|
||||
|
||||
## 0.10.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/func@0.14.1
|
||||
|
||||
## 0.10.0
|
||||
|
||||
### Minor Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/slave",
|
||||
"version": "0.10.0",
|
||||
"version": "0.11.0",
|
||||
"description": "微前端子应用方法库",
|
||||
"keywords": [
|
||||
"slave",
|
||||
|
Loading…
Reference in New Issue
Block a user