Skip to content

Commit

Permalink
2.0.11 发布
Browse files Browse the repository at this point in the history
  • Loading branch information
987153776 committed Jul 16, 2020
1 parent 4d27d03 commit efbd5c2
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 18 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

#### :rocket: New Features
* `Utils`工具类
* 新增`reset(): void`方法来重置图片状态。
* 新增`rotateTo (angle: number, animation = false): void`方法来旋转图片到指定角度。

## 2.0.10 (2020-07-16)

#### :rocket: New Features
* `Utils`工具类
* 新增`reset(): void`方法来重置图片状态。

## 2.0.9 (2020-07-15)

Expand Down
15 changes: 10 additions & 5 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,25 +587,30 @@ createAnimation会返回一个Animation对象
**参数 angle**:逆时针角度
**参数 animation**:是否进行动画

7. `setFlipV(animation?: boolean): void`
7. `rotateTo (angle: number, animation = false): void`
**描述**:图片旋转指定角度
**参数 angle**:逆时针角度
**参数 animation**:是否进行动画

8. `setFlipV(animation?: boolean): void`
**描述**:图片垂直翻转
**参数 animation**:是否进行动画

8. `setFlipH(animation?: boolean): void`
9. `setFlipH(animation?: boolean): void`
**描述**:图片水平翻转
**参数 animation**:是否进行动画

9. `setFlip (sV: boolean, sH: boolean, animation?: boolean): void`
10. `setFlip (sV: boolean, sH: boolean, animation?: boolean): void`
**描述**:图片翻转
**参数 sV**:垂直,true (翻转),false (原始)。
**参数 sH**:水平,true (翻转),false (原始)。
**参数 animation**:是否进行动画

10. `scale(zoom: number): void`
11. `scale(zoom: number): void`
**描述**:图片缩放
**参数 zoom**:缩放系数

11. `reset(): void`
12. `reset(): void`
**描述**:重置图片状态


Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,25 +529,30 @@ ParamsInterface is an array containing four number types.
**param angle**:Counterclockwise angle.
**param animation**:Do you want to show animation.

7. `setFlipV(animation?: boolean): void`
7. `rotateTo (angle: number, animation = false): void`
**describe**:Rotate the picture at a specified angle.
**param angle**:Counterclockwise angle.
**param animation**:Do you want to show animation.

8. `setFlipV(animation?: boolean): void`
**describe**:Picture vertical flip
**param animation**:Do you want to show animation.

8. `setFlipH(animation?: boolean): void`
9. `setFlipH(animation?: boolean): void`
**describe**:Picture flip horizontally
**param animation**:Do you want to show animation.

9. `setFlip (sV: boolean, sH: boolean, animation?: boolean): void`
10. `setFlip (sV: boolean, sH: boolean, animation?: boolean): void`
**describe**:Pictures flipping.
**param sV**:Vertical,true (flipping),false (original)。
**param sH**:Vorizontal,true (flipping),false (original)。
**param animation**:Do you want to show animation.

10. `scale(zoom: number): void`
11. `scale(zoom: number): void`
**describe**:Picture zoom.
**param zoom**:The scale of the scaled size to the current size.

11. `reset(): void`
12. `reset(): void`
**describe**:Reset picture status.

### 3、Custom extension
Expand Down
2 changes: 1 addition & 1 deletion dist/js/app.js

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion lib/vue-picture-cut.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -11253,6 +11253,7 @@ var vue_picture_cut_menu_component = normalizeComponent(




/**
* 二次包装工具类
* 简化api,方便自定义菜单等
Expand Down Expand Up @@ -11364,6 +11365,23 @@ var Utils_Utils = /*#__PURE__*/function () {
var main = this.photoRoot.getEventList('PhotoMain');
main === null || main === void 0 ? void 0 : main.setAngle(main.showRect.r + angle, animation);
}
/**
* 图片旋转到指定角度
* @param angle 逆时针角度
* @param animation 是否动画
*/

}, {
key: "rotateTo",
value: function rotateTo(angle) {
var animation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (!this.photoRoot) return;
var main = this.photoRoot.getEventList('PhotoMain');

if (main && main.showRect.r + angle % 360) {
main.setAngle(angle, animation);
}
}
/**
* 设置图片垂直翻转
* @param animation 是否动画
Expand Down Expand Up @@ -11418,7 +11436,11 @@ var Utils_Utils = /*#__PURE__*/function () {
return Utils;
}();
function createUtils(cut) {
return new Utils_Utils(cut);
if (!cut || !cut.photoRoot) {
throw new Error("createUtils\u9700\u8981\u4E00\u4E2A\u4E3AVuePictureCut\u5B9E\u4F8B\u7684\u53C2\u6570\uFF0C\u4F46\u662F\u5F53\u524D\u5F97\u5230\u7684\u662F".concat(cut, "!\n\n \"createUtils\" requires an argument for the \"VuePictureCut\" instance, but the current result is ").concat(cut, "!"));
} else {
return new Utils_Utils(cut);
}
}
// CONCATENATED MODULE: ./src/lib/index.ts

Expand Down
24 changes: 23 additions & 1 deletion lib/vue-picture-cut.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -11262,6 +11262,7 @@ var vue_picture_cut_menu_component = normalizeComponent(




/**
* 二次包装工具类
* 简化api,方便自定义菜单等
Expand Down Expand Up @@ -11373,6 +11374,23 @@ var Utils_Utils = /*#__PURE__*/function () {
var main = this.photoRoot.getEventList('PhotoMain');
main === null || main === void 0 ? void 0 : main.setAngle(main.showRect.r + angle, animation);
}
/**
* 图片旋转到指定角度
* @param angle 逆时针角度
* @param animation 是否动画
*/

}, {
key: "rotateTo",
value: function rotateTo(angle) {
var animation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (!this.photoRoot) return;
var main = this.photoRoot.getEventList('PhotoMain');

if (main && main.showRect.r + angle % 360) {
main.setAngle(angle, animation);
}
}
/**
* 设置图片垂直翻转
* @param animation 是否动画
Expand Down Expand Up @@ -11427,7 +11445,11 @@ var Utils_Utils = /*#__PURE__*/function () {
return Utils;
}();
function createUtils(cut) {
return new Utils_Utils(cut);
if (!cut || !cut.photoRoot) {
throw new Error("createUtils\u9700\u8981\u4E00\u4E2A\u4E3AVuePictureCut\u5B9E\u4F8B\u7684\u53C2\u6570\uFF0C\u4F46\u662F\u5F53\u524D\u5F97\u5230\u7684\u662F".concat(cut, "!\n\n \"createUtils\" requires an argument for the \"VuePictureCut\" instance, but the current result is ").concat(cut, "!"));
} else {
return new Utils_Utils(cut);
}
}
// CONCATENATED MODULE: ./src/lib/index.ts

Expand Down
4 changes: 2 additions & 2 deletions lib/vue-picture-cut.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-picture-cut",
"version": "2.0.10",
"version": "2.0.11",
"description": "基于vue和typescript开发的一款图片剪裁处理工具。优点:原生、轻量、使用简单、功能全面、扩展性强。目前功能:缩放、翻折、旋转、边缘校验、矩形剪裁、任意(椭)圆剪裁。",
"main": "lib/vue-picture-cut.umd.min.js",
"directories": {
Expand Down
22 changes: 21 additions & 1 deletion src/lib/views/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ export class Utils {
main?.setAngle(main.showRect.r + angle, animation);
}

/**
* 图片旋转到指定角度
* @param angle 逆时针角度
* @param animation 是否动画
*/
rotateTo (angle: number, animation = false): void {
if (!this.photoRoot) return;
const main = this.photoRoot.getEventList<PhotoMain>('PhotoMain');
if (main && main.showRect.r + angle % 360) {
main.setAngle(angle, animation);
}
}

/**
* 设置图片垂直翻转
* @param animation 是否动画
Expand Down Expand Up @@ -137,5 +150,12 @@ export class Utils {
}

export default function createUtils(cut: CutInterface): Utils {
return new Utils(cut);
if (!cut || !cut.photoRoot) {
throw new Error(
`createUtils需要一个为VuePictureCut实例的参数,但是当前得到的是${cut}!\n
"createUtils" requires an argument for the "VuePictureCut" instance, but the current result is ${cut}!`
);
} else {
return new Utils(cut);
}
}

0 comments on commit efbd5c2

Please sign in to comment.