@leafer-in/resize 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-in/resize",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "@leafer-in/resize",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  "leaferjs"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@leafer-ui/draw": "^2.2.0",
38
- "@leafer-ui/interface": "^2.2.0",
39
- "@leafer-in/interface": "^2.2.0"
37
+ "@leafer-ui/draw": "^2.2.1",
38
+ "@leafer-ui/interface": "^2.2.1",
39
+ "@leafer-in/interface": "^2.2.1"
40
40
  }
41
41
  }
package/dist/resize.cjs DELETED
@@ -1,271 +0,0 @@
1
- "use strict";
2
-
3
- var draw = require("@leafer-ui/draw");
4
-
5
- const {M: M, L: L, C: C, Q: Q, Z: Z, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = draw.PathCommandMap;
6
-
7
- const PathScaler = {
8
- scale(data, scaleX, scaleY) {
9
- if (!data) return;
10
- let command;
11
- let i = 0, len = data.length;
12
- while (i < len) {
13
- command = data[i];
14
- switch (command) {
15
- case M:
16
- case L:
17
- scalePoints(data, scaleX, scaleY, i, 1);
18
- i += 3;
19
- break;
20
-
21
- case C:
22
- scalePoints(data, scaleX, scaleY, i, 3);
23
- i += 7;
24
- break;
25
-
26
- case Q:
27
- scalePoints(data, scaleX, scaleY, i, 2);
28
- i += 5;
29
- break;
30
-
31
- case Z:
32
- i += 1;
33
- break;
34
-
35
- case N:
36
- scalePoints(data, scaleX, scaleY, i, 2);
37
- i += 5;
38
- break;
39
-
40
- case D:
41
- scalePoints(data, scaleX, scaleY, i, 2);
42
- i += 9;
43
- break;
44
-
45
- case X:
46
- scalePoints(data, scaleX, scaleY, i, 2);
47
- i += 6;
48
- break;
49
-
50
- case G:
51
- scalePoints(data, scaleX, scaleY, i, 2);
52
- i += 9;
53
- break;
54
-
55
- case F:
56
- scalePoints(data, scaleX, scaleY, i, 2);
57
- i += 5;
58
- break;
59
-
60
- case O:
61
- data[i] = G;
62
- data.splice(i + 4, 0, data[i + 3], 0);
63
- scalePoints(data, scaleX, scaleY, i, 2);
64
- i += 7 + 2;
65
- len += 2;
66
- break;
67
-
68
- case P:
69
- data[i] = F;
70
- data.splice(i + 4, 0, data[i + 3]);
71
- scalePoints(data, scaleX, scaleY, i, 2);
72
- i += 4 + 1;
73
- len += 1;
74
- break;
75
-
76
- case U:
77
- scalePoints(data, scaleX, scaleY, i, 2);
78
- i += 6;
79
- break;
80
- }
81
- }
82
- },
83
- scalePoints(data, scaleX, scaleY, start, pointCount) {
84
- for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {
85
- data[i] *= scaleX;
86
- data[i + 1] *= scaleY;
87
- }
88
- }
89
- };
90
-
91
- const {scalePoints: scalePoints} = PathScaler;
92
-
93
- const matrix = draw.MatrixHelper.get();
94
-
95
- const {topLeft: topLeft, top: top, topRight: topRight, right: right, bottom: bottom, left: left} = draw.Direction9;
96
-
97
- function scaleResize(leaf, scaleX, scaleY) {
98
- if (leaf.pathInputed) {
99
- scaleResizePath(leaf, scaleX, scaleY);
100
- } else {
101
- if (scaleX !== 1) leaf.width *= scaleX;
102
- if (scaleY !== 1) leaf.height *= scaleY;
103
- }
104
- }
105
-
106
- function scaleResizeFontSize(leaf, scaleX, scaleY, direction) {
107
- let fontScale = scaleX;
108
- if (!draw.isUndefined(direction)) {
109
- const layout = leaf.__layout;
110
- let {width: width, height: height} = layout.boxBounds;
111
- width *= scaleY - scaleX;
112
- height *= scaleX - scaleY;
113
- switch (direction) {
114
- case top:
115
- case bottom:
116
- fontScale = scaleY;
117
- layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2;
118
- break;
119
-
120
- case left:
121
- case right:
122
- layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2;
123
- break;
124
-
125
- case topLeft:
126
- case topRight:
127
- layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height;
128
- break;
129
- }
130
- }
131
- leaf.fontSize *= fontScale;
132
- const data = leaf.__, {padding: padding, lineHeight: lineHeight, letterSpacing: letterSpacing} = data;
133
- if (padding) leaf.padding = draw.isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale;
134
- if (!data.__autoWidth) leaf.width *= fontScale;
135
- if (!data.__autoHeight) leaf.height *= fontScale;
136
- if (draw.isObject(lineHeight)) {
137
- if (lineHeight.type === "px") data.lineHeight = {
138
- type: "px",
139
- value: lineHeight.value * fontScale
140
- };
141
- } else if (lineHeight) data.lineHeight = lineHeight * fontScale;
142
- if (draw.isObject(letterSpacing)) {
143
- if (letterSpacing.type === "px") data.letterSpacing = {
144
- type: "px",
145
- value: letterSpacing.value * fontScale
146
- };
147
- } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale;
148
- }
149
-
150
- function scaleResizePath(leaf, scaleX, scaleY) {
151
- PathScaler.scale(leaf.__.path, scaleX, scaleY);
152
- leaf.path = leaf.__.path;
153
- }
154
-
155
- function scaleResizePoints(leaf, scaleX, scaleY) {
156
- const {points: points} = leaf;
157
- draw.isObject(points[0]) ? points.forEach(p => {
158
- p.x *= scaleX, p.y *= scaleY;
159
- }) : PathScaler.scalePoints(points, scaleX, scaleY);
160
- leaf.points = points;
161
- }
162
-
163
- function scaleResizeGroup(group, scaleX, scaleY) {
164
- const {children: children} = group;
165
- for (let i = 0; i < children.length; i++) {
166
- matrix.a = scaleX;
167
- matrix.d = scaleY;
168
- children[i].transform(matrix, true);
169
- }
170
- }
171
-
172
- const leaf = draw.Leaf.prototype, tempPoint = {}, tempMatrix = {}, {copy: copy, scale: scale, toOuterPoint: toOuterPoint} = draw.MatrixHelper;
173
-
174
- leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize, boundsType) {
175
- const data = this;
176
- if (noResize || data.editConfig && data.editConfig.editSize === "scale") {
177
- data.scaleX *= scaleX;
178
- data.scaleY *= scaleY;
179
- } else {
180
- if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX;
181
- if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY;
182
- if (boundsType === "stroke") {
183
- copy(tempMatrix, this.__localMatrix);
184
- if (scaleX < 0) scale(tempMatrix, -1, 1);
185
- if (scaleY < 0) scale(tempMatrix, 1, -1);
186
- const {boxBounds: boxBounds, strokeBounds: strokeBounds} = this.__layout, {x: x, y: y, width: width, height: height} = strokeBounds;
187
- tempPoint.x = (x - boxBounds.x) * (scaleX - 1);
188
- tempPoint.y = (y - boxBounds.y) * (scaleY - 1);
189
- toOuterPoint(tempMatrix, tempPoint, tempPoint, true);
190
- this.x += tempPoint.x;
191
- this.y += tempPoint.y;
192
- scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width;
193
- scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height;
194
- }
195
- this.__scaleResize(scaleX, scaleY);
196
- }
197
- };
198
-
199
- leaf.__scaleResize = function(scaleX, scaleY) {
200
- scaleResize(this, scaleX, scaleY);
201
- };
202
-
203
- leaf.resizeWidth = function(width, relative = "inner") {
204
- const scale = width / this.getBounds("box", relative).width || 1;
205
- this.scaleOf("top-left", scale, this.__.lockRatio ? scale : 1, true);
206
- };
207
-
208
- leaf.resizeHeight = function(height, relative = "inner") {
209
- const scale = height / this.getBounds("box", relative).height || 1;
210
- this.scaleOf("top-left", this.__.lockRatio ? scale : 1, scale, true);
211
- };
212
-
213
- draw.Text.prototype.__scaleResize = function(scaleX, scaleY) {
214
- const {app: app, editConfig: editConfig} = this, editor = app && app.editor, dragPoint = editor && editor.dragPoint;
215
- if (this.__.resizeFontSize || editConfig && editConfig.editSize === "font-size" || dragPoint && editor.mergedConfig.editSize === "font-size") {
216
- scaleResizeFontSize(this, scaleX, scaleY, dragPoint && dragPoint.direction);
217
- } else {
218
- const {__autoWidth: __autoWidth, __autoHeight: __autoHeight, textAlign: textAlign, verticalAlign: verticalAlign} = this.__, {boxBounds: boxBounds} = this.__layout;
219
- if (__autoWidth && textAlign !== "left" && scaleX !== 1) this.x += boxBounds.x;
220
- if (__autoHeight && verticalAlign !== "top" && scaleY !== 1) this.y += boxBounds.y;
221
- scaleResize(this, scaleX, scaleY);
222
- }
223
- };
224
-
225
- draw.Path.prototype.__scaleResize = function(scaleX, scaleY) {
226
- scaleResizePath(this, scaleX, scaleY);
227
- };
228
-
229
- draw.Line.prototype.__scaleResize = function(scaleX, scaleY) {
230
- if (this.pathInputed) {
231
- scaleResizePath(this, scaleX, scaleY);
232
- } else if (this.points) {
233
- scaleResizePoints(this, scaleX, scaleY);
234
- } else {
235
- this.width *= scaleX;
236
- }
237
- };
238
-
239
- draw.Polygon.prototype.__scaleResize = function(scaleX, scaleY) {
240
- if (this.pathInputed) {
241
- scaleResizePath(this, scaleX, scaleY);
242
- } else if (this.points) {
243
- scaleResizePoints(this, scaleX, scaleY);
244
- } else {
245
- scaleResize(this, scaleX, scaleY);
246
- }
247
- };
248
-
249
- draw.Group.prototype.__scaleResize = function(scaleX, scaleY) {
250
- scaleResizeGroup(this, scaleX, scaleY);
251
- };
252
-
253
- draw.Box.prototype.__scaleResize = function(scaleX, scaleY) {
254
- const {resizeChildren: resizeChildren, __autoSize: __autoSize} = this.__;
255
- if (!(__autoSize && resizeChildren)) scaleResize(this, scaleX, scaleY);
256
- if (resizeChildren) scaleResizeGroup(this, scaleX, scaleY);
257
- };
258
-
259
- draw.Plugin.add("resize");
260
-
261
- exports.PathScaler = PathScaler;
262
-
263
- exports.scaleResize = scaleResize;
264
-
265
- exports.scaleResizeFontSize = scaleResizeFontSize;
266
-
267
- exports.scaleResizeGroup = scaleResizeGroup;
268
-
269
- exports.scaleResizePath = scaleResizePath;
270
-
271
- exports.scaleResizePoints = scaleResizePoints;
@@ -1,259 +0,0 @@
1
- import { PathCommandMap, MatrixHelper, Direction9, isUndefined, isArray, isObject, Leaf, Text, Path, Line, Polygon, Group, Box, Plugin } from "@leafer-ui/draw";
2
-
3
- const {M: M, L: L, C: C, Q: Q, Z: Z, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
4
-
5
- const PathScaler = {
6
- scale(data, scaleX, scaleY) {
7
- if (!data) return;
8
- let command;
9
- let i = 0, len = data.length;
10
- while (i < len) {
11
- command = data[i];
12
- switch (command) {
13
- case M:
14
- case L:
15
- scalePoints(data, scaleX, scaleY, i, 1);
16
- i += 3;
17
- break;
18
-
19
- case C:
20
- scalePoints(data, scaleX, scaleY, i, 3);
21
- i += 7;
22
- break;
23
-
24
- case Q:
25
- scalePoints(data, scaleX, scaleY, i, 2);
26
- i += 5;
27
- break;
28
-
29
- case Z:
30
- i += 1;
31
- break;
32
-
33
- case N:
34
- scalePoints(data, scaleX, scaleY, i, 2);
35
- i += 5;
36
- break;
37
-
38
- case D:
39
- scalePoints(data, scaleX, scaleY, i, 2);
40
- i += 9;
41
- break;
42
-
43
- case X:
44
- scalePoints(data, scaleX, scaleY, i, 2);
45
- i += 6;
46
- break;
47
-
48
- case G:
49
- scalePoints(data, scaleX, scaleY, i, 2);
50
- i += 9;
51
- break;
52
-
53
- case F:
54
- scalePoints(data, scaleX, scaleY, i, 2);
55
- i += 5;
56
- break;
57
-
58
- case O:
59
- data[i] = G;
60
- data.splice(i + 4, 0, data[i + 3], 0);
61
- scalePoints(data, scaleX, scaleY, i, 2);
62
- i += 7 + 2;
63
- len += 2;
64
- break;
65
-
66
- case P:
67
- data[i] = F;
68
- data.splice(i + 4, 0, data[i + 3]);
69
- scalePoints(data, scaleX, scaleY, i, 2);
70
- i += 4 + 1;
71
- len += 1;
72
- break;
73
-
74
- case U:
75
- scalePoints(data, scaleX, scaleY, i, 2);
76
- i += 6;
77
- break;
78
- }
79
- }
80
- },
81
- scalePoints(data, scaleX, scaleY, start, pointCount) {
82
- for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {
83
- data[i] *= scaleX;
84
- data[i + 1] *= scaleY;
85
- }
86
- }
87
- };
88
-
89
- const {scalePoints: scalePoints} = PathScaler;
90
-
91
- const matrix = MatrixHelper.get();
92
-
93
- const {topLeft: topLeft, top: top, topRight: topRight, right: right, bottom: bottom, left: left} = Direction9;
94
-
95
- function scaleResize(leaf, scaleX, scaleY) {
96
- if (leaf.pathInputed) {
97
- scaleResizePath(leaf, scaleX, scaleY);
98
- } else {
99
- if (scaleX !== 1) leaf.width *= scaleX;
100
- if (scaleY !== 1) leaf.height *= scaleY;
101
- }
102
- }
103
-
104
- function scaleResizeFontSize(leaf, scaleX, scaleY, direction) {
105
- let fontScale = scaleX;
106
- if (!isUndefined(direction)) {
107
- const layout = leaf.__layout;
108
- let {width: width, height: height} = layout.boxBounds;
109
- width *= scaleY - scaleX;
110
- height *= scaleX - scaleY;
111
- switch (direction) {
112
- case top:
113
- case bottom:
114
- fontScale = scaleY;
115
- layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2;
116
- break;
117
-
118
- case left:
119
- case right:
120
- layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2;
121
- break;
122
-
123
- case topLeft:
124
- case topRight:
125
- layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height;
126
- break;
127
- }
128
- }
129
- leaf.fontSize *= fontScale;
130
- const data = leaf.__, {padding: padding, lineHeight: lineHeight, letterSpacing: letterSpacing} = data;
131
- if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale;
132
- if (!data.__autoWidth) leaf.width *= fontScale;
133
- if (!data.__autoHeight) leaf.height *= fontScale;
134
- if (isObject(lineHeight)) {
135
- if (lineHeight.type === "px") data.lineHeight = {
136
- type: "px",
137
- value: lineHeight.value * fontScale
138
- };
139
- } else if (lineHeight) data.lineHeight = lineHeight * fontScale;
140
- if (isObject(letterSpacing)) {
141
- if (letterSpacing.type === "px") data.letterSpacing = {
142
- type: "px",
143
- value: letterSpacing.value * fontScale
144
- };
145
- } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale;
146
- }
147
-
148
- function scaleResizePath(leaf, scaleX, scaleY) {
149
- PathScaler.scale(leaf.__.path, scaleX, scaleY);
150
- leaf.path = leaf.__.path;
151
- }
152
-
153
- function scaleResizePoints(leaf, scaleX, scaleY) {
154
- const {points: points} = leaf;
155
- isObject(points[0]) ? points.forEach(p => {
156
- p.x *= scaleX, p.y *= scaleY;
157
- }) : PathScaler.scalePoints(points, scaleX, scaleY);
158
- leaf.points = points;
159
- }
160
-
161
- function scaleResizeGroup(group, scaleX, scaleY) {
162
- const {children: children} = group;
163
- for (let i = 0; i < children.length; i++) {
164
- matrix.a = scaleX;
165
- matrix.d = scaleY;
166
- children[i].transform(matrix, true);
167
- }
168
- }
169
-
170
- const leaf = Leaf.prototype, tempPoint = {}, tempMatrix = {}, {copy: copy, scale: scale, toOuterPoint: toOuterPoint} = MatrixHelper;
171
-
172
- leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize, boundsType) {
173
- const data = this;
174
- if (noResize || data.editConfig && data.editConfig.editSize === "scale") {
175
- data.scaleX *= scaleX;
176
- data.scaleY *= scaleY;
177
- } else {
178
- if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX;
179
- if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY;
180
- if (boundsType === "stroke") {
181
- copy(tempMatrix, this.__localMatrix);
182
- if (scaleX < 0) scale(tempMatrix, -1, 1);
183
- if (scaleY < 0) scale(tempMatrix, 1, -1);
184
- const {boxBounds: boxBounds, strokeBounds: strokeBounds} = this.__layout, {x: x, y: y, width: width, height: height} = strokeBounds;
185
- tempPoint.x = (x - boxBounds.x) * (scaleX - 1);
186
- tempPoint.y = (y - boxBounds.y) * (scaleY - 1);
187
- toOuterPoint(tempMatrix, tempPoint, tempPoint, true);
188
- this.x += tempPoint.x;
189
- this.y += tempPoint.y;
190
- scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width;
191
- scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height;
192
- }
193
- this.__scaleResize(scaleX, scaleY);
194
- }
195
- };
196
-
197
- leaf.__scaleResize = function(scaleX, scaleY) {
198
- scaleResize(this, scaleX, scaleY);
199
- };
200
-
201
- leaf.resizeWidth = function(width, relative = "inner") {
202
- const scale = width / this.getBounds("box", relative).width || 1;
203
- this.scaleOf("top-left", scale, this.__.lockRatio ? scale : 1, true);
204
- };
205
-
206
- leaf.resizeHeight = function(height, relative = "inner") {
207
- const scale = height / this.getBounds("box", relative).height || 1;
208
- this.scaleOf("top-left", this.__.lockRatio ? scale : 1, scale, true);
209
- };
210
-
211
- Text.prototype.__scaleResize = function(scaleX, scaleY) {
212
- const {app: app, editConfig: editConfig} = this, editor = app && app.editor, dragPoint = editor && editor.dragPoint;
213
- if (this.__.resizeFontSize || editConfig && editConfig.editSize === "font-size" || dragPoint && editor.mergedConfig.editSize === "font-size") {
214
- scaleResizeFontSize(this, scaleX, scaleY, dragPoint && dragPoint.direction);
215
- } else {
216
- const {__autoWidth: __autoWidth, __autoHeight: __autoHeight, textAlign: textAlign, verticalAlign: verticalAlign} = this.__, {boxBounds: boxBounds} = this.__layout;
217
- if (__autoWidth && textAlign !== "left" && scaleX !== 1) this.x += boxBounds.x;
218
- if (__autoHeight && verticalAlign !== "top" && scaleY !== 1) this.y += boxBounds.y;
219
- scaleResize(this, scaleX, scaleY);
220
- }
221
- };
222
-
223
- Path.prototype.__scaleResize = function(scaleX, scaleY) {
224
- scaleResizePath(this, scaleX, scaleY);
225
- };
226
-
227
- Line.prototype.__scaleResize = function(scaleX, scaleY) {
228
- if (this.pathInputed) {
229
- scaleResizePath(this, scaleX, scaleY);
230
- } else if (this.points) {
231
- scaleResizePoints(this, scaleX, scaleY);
232
- } else {
233
- this.width *= scaleX;
234
- }
235
- };
236
-
237
- Polygon.prototype.__scaleResize = function(scaleX, scaleY) {
238
- if (this.pathInputed) {
239
- scaleResizePath(this, scaleX, scaleY);
240
- } else if (this.points) {
241
- scaleResizePoints(this, scaleX, scaleY);
242
- } else {
243
- scaleResize(this, scaleX, scaleY);
244
- }
245
- };
246
-
247
- Group.prototype.__scaleResize = function(scaleX, scaleY) {
248
- scaleResizeGroup(this, scaleX, scaleY);
249
- };
250
-
251
- Box.prototype.__scaleResize = function(scaleX, scaleY) {
252
- const {resizeChildren: resizeChildren, __autoSize: __autoSize} = this.__;
253
- if (!(__autoSize && resizeChildren)) scaleResize(this, scaleX, scaleY);
254
- if (resizeChildren) scaleResizeGroup(this, scaleX, scaleY);
255
- };
256
-
257
- Plugin.add("resize");
258
-
259
- export { PathScaler, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints };
@@ -1,2 +0,0 @@
1
- import{PathCommandMap as t,MatrixHelper as e,Direction9 as i,isUndefined as s,isArray as o,isObject as a,Leaf as n,Text as c,Path as h,Line as l,Polygon as r,Group as p,Box as _,Plugin as f}from"@leafer-ui/draw";const{M:d,L:u,C:g,Q:y,Z:z,N:x,D:b,X:k,G:R,F:S,O:w,P:m,U:v}=t,O={scale(t,e,i){if(!t)return;let s,o=0,a=t.length;for(;o<a;)switch(s=t[o],s){case d:case u:B(t,e,i,o,1),o+=3;break;case g:B(t,e,i,o,3),o+=7;break;case y:B(t,e,i,o,2),o+=5;break;case z:o+=1;break;case x:B(t,e,i,o,2),o+=5;break;case b:B(t,e,i,o,2),o+=9;break;case k:B(t,e,i,o,2),o+=6;break;case R:B(t,e,i,o,2),o+=9;break;case S:B(t,e,i,o,2),o+=5;break;case w:t[o]=R,t.splice(o+4,0,t[o+3],0),B(t,e,i,o,2),o+=9,a+=2;break;case m:t[o]=S,t.splice(o+4,0,t[o+3]),B(t,e,i,o,2),o+=5,a+=1;break;case v:B(t,e,i,o,2),o+=6}},scalePoints(t,e,i,s,o){for(let a=o?s+1:0,n=o?a+2*o:t.length;a<n;a+=2)t[a]*=e,t[a+1]*=i}},{scalePoints:B}=O,C=e.get(),{topLeft:H,top:I,topRight:P,right:W,bottom:X,left:A}=i;function F(t,e,i){t.pathInputed?M(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function L(t,e,i,n){let c=e;if(!s(n)){const s=t.__layout;let{width:o,height:a}=s.boxBounds;switch(o*=i-e,a*=e-i,n){case I:case X:c=i,s.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case A:case W:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case H:case P:s.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=c;const h=t.__,{padding:l,lineHeight:r,letterSpacing:p}=h;l&&(t.padding=o(l)?l.map(t=>t*c):l*c),h.__autoWidth||(t.width*=c),h.__autoHeight||(t.height*=c),a(r)?"px"===r.type&&(h.lineHeight={type:"px",value:r.value*c}):r&&(h.lineHeight=r*c),a(p)?"px"===p.type&&(h.letterSpacing={type:"px",value:p.value*c}):p&&(h.letterSpacing=p*c)}function M(t,e,i){O.scale(t.__.path,e,i),t.path=t.__.path}function Y(t,e,i){const{points:s}=t;a(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):O.scalePoints(s,e,i),t.points=s}function D(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)C.a=e,C.d=i,s[t].transform(C,!0)}const E=n.prototype,G={},N={},{copy:Q,scale:U,toOuterPoint:Z}=e;E.scaleResize=function(t,e=t,i,s){const o=this;if(i||o.editConfig&&"scale"===o.editConfig.editSize)o.scaleX*=t,o.scaleY*=e;else{if(t<0&&(o.scaleX*=-1,t=-t),e<0&&(o.scaleY*=-1,e=-e),"stroke"===s){Q(N,this.__localMatrix),t<0&&U(N,-1,1),e<0&&U(N,1,-1);const{boxBounds:i,strokeBounds:s}=this.__layout,{x:o,y:a,width:n,height:c}=s;G.x=(o-i.x)*(t-1),G.y=(a-i.y)*(e-1),Z(N,G,G,!0),this.x+=G.x,this.y+=G.y,t=(n*t-(n-i.width))/i.width,e=(c*e-(c-i.height))/i.height}this.__scaleResize(t,e)}},E.__scaleResize=function(t,e){F(this,t,e)},E.resizeWidth=function(t,e="inner"){const i=t/this.getBounds("box",e).width||1;this.scaleOf("top-left",i,this.__.lockRatio?i:1,!0)},E.resizeHeight=function(t,e="inner"){const i=t/this.getBounds("box",e).height||1;this.scaleOf("top-left",this.__.lockRatio?i:1,i,!0)},c.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,o=i&&i.editor,a=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||a&&"font-size"===o.mergedConfig.editSize)L(this,t,e,a&&a.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:a}=this.__,{boxBounds:n}=this.__layout;i&&"left"!==o&&1!==t&&(this.x+=n.x),s&&"top"!==a&&1!==e&&(this.y+=n.y),F(this,t,e)}},h.prototype.__scaleResize=function(t,e){M(this,t,e)},l.prototype.__scaleResize=function(t,e){this.pathInputed?M(this,t,e):this.points?Y(this,t,e):this.width*=t},r.prototype.__scaleResize=function(t,e){this.pathInputed?M(this,t,e):this.points?Y(this,t,e):F(this,t,e)},p.prototype.__scaleResize=function(t,e){D(this,t,e)},_.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||F(this,t,e),i&&D(this,t,e)},f.add("resize");export{O as PathScaler,F as scaleResize,L as scaleResizeFontSize,D as scaleResizeGroup,M as scaleResizePath,Y as scaleResizePoints};
2
- //# sourceMappingURL=resize.esm.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resize.esm.min.js","sources":["../../../../../../src/in/packages/resize/src/PathScaler.ts","../../../../../../src/in/packages/resize/src/scaler.ts","../../../../../../src/in/packages/resize/src/resize.ts","../../../../../../src/in/packages/resize/src/index.ts"],"sourcesContent":["import { IPathCommandData } from '@leafer-ui/interface'\n\nimport { PathCommandMap as Command } from '@leafer-ui/draw'\n\n\nconst { M, L, C, Q, Z, N, D, X, G, F, O, P, U } = Command\n\nexport const PathScaler = {\n\n scale(data: IPathCommandData, scaleX: number, scaleY: number): void {\n if (!data) return\n\n let command: number\n let i = 0, len = data.length\n\n while (i < len) {\n command = data[i]\n switch (command) {\n case M: //moveto(x, y)\n case L: //lineto(x, y)\n scalePoints(data, scaleX, scaleY, i, 1)\n i += 3\n break\n case C: //bezierCurveTo(x1, y1, x2, y2, x, y)\n scalePoints(data, scaleX, scaleY, i, 3)\n i += 7\n break\n case Q: //quadraticCurveTo(x1, y1, x, y)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case Z: //closepath()\n i += 1\n break\n\n // canvas command\n\n case N: // rect(x, y, width, height)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case D: // roundRect(x, y, width, height, radius1, radius2, radius3, radius4)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 9\n break\n case X: // simple roundRect(x, y, width, height, radius)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 6\n break\n case G: // ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 9\n break\n case F: // simple ellipse(x, y, radiusX, radiusY)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case O: // arc(x, y, radius, startAngle, endAngle, anticlockwise)\n data[i] = G // to ellipse\n data.splice(i + 4, 0, data[i + 3], 0)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 7 + 2\n len += 2\n break\n case P: // simple arc(x, y, radius)\n data[i] = F // to simple ellipse\n data.splice(i + 4, 0, data[i + 3])\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 4 + 1\n len += 1\n break\n case U: // arcTo(x1, y1, x2, y2, radius)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 6\n break\n }\n }\n\n },\n\n scalePoints(data: IPathCommandData, scaleX: number, scaleY: number, start?: number, pointCount?: number): void {\n for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {\n data[i] *= scaleX\n data[i + 1] *= scaleY\n }\n }\n\n}\n\nconst { scalePoints } = PathScaler","import { IBranch, ILeaf, ILine, IPolygon, IText, IPointData } from '@leafer-ui/interface'\nimport { Direction9, MatrixHelper, isArray, isObject, isUndefined } from '@leafer-ui/draw'\n\nimport { PathScaler } from './PathScaler'\n\n\nconst matrix = MatrixHelper.get()\nconst { topLeft, top, topRight, right, bottom, left } = Direction9\n\nexport function scaleResize(leaf: ILeaf, scaleX: number, scaleY: number): void {\n if (leaf.pathInputed) {\n scaleResizePath(leaf, scaleX, scaleY)\n } else {\n // fix: Text / Box auto width / height, need check scale === 1\n if (scaleX !== 1) leaf.width *= scaleX\n if (scaleY !== 1) leaf.height *= scaleY\n }\n}\n\nexport function scaleResizeFontSize(leaf: IText, scaleX: number, scaleY: number, direction?: Direction9): void {\n let fontScale = scaleX\n\n if (!isUndefined(direction)) {\n\n const layout = leaf.__layout\n\n let { width, height } = layout.boxBounds\n width *= scaleY - scaleX\n height *= scaleX - scaleY\n\n switch (direction) { // 编辑器控制点的位置\n case top:\n case bottom:\n fontScale = scaleY\n layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2\n break\n case left:\n case right:\n layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2\n break\n case topLeft:\n case topRight:\n layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height\n break\n }\n\n }\n\n leaf.fontSize *= fontScale\n\n const data = leaf.__, { padding, lineHeight, letterSpacing } = data\n if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale\n if (!data.__autoWidth) leaf.width *= fontScale\n if (!data.__autoHeight) leaf.height *= fontScale\n\n if (isObject(lineHeight)) {\n if (lineHeight.type === 'px') data.lineHeight = { type: 'px', value: lineHeight.value * fontScale }\n } else if (lineHeight) data.lineHeight = lineHeight * fontScale\n\n if (isObject(letterSpacing)) {\n if (letterSpacing.type === 'px') data.letterSpacing = { type: 'px', value: letterSpacing.value * fontScale }\n } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale\n\n}\n\nexport function scaleResizePath(leaf: ILeaf, scaleX: number, scaleY: number): void {\n PathScaler.scale(leaf.__.path, scaleX, scaleY)\n leaf.path = leaf.__.path\n}\n\nexport function scaleResizePoints(leaf: ILine | IPolygon, scaleX: number, scaleY: number): void {\n const { points } = leaf\n isObject(points[0]) ? (points as IPointData[]).forEach(p => { p.x *= scaleX, p.y *= scaleY }) : PathScaler.scalePoints(points as number[], scaleX, scaleY)\n leaf.points = points\n}\n\n\nexport function scaleResizeGroup(group: IBranch, scaleX: number, scaleY: number): void {\n const { children } = group\n for (let i = 0; i < children.length; i++) {\n matrix.a = scaleX // must update\n matrix.d = scaleY\n children[i].transform(matrix, true)\n }\n}","import { IBoundsType, ILeaf, IPointData, IMatrixData, ILocationType } from '@leafer-ui/interface'\nimport { Leaf, Path, Line, Text, Polygon, Group, Box, UI, MatrixHelper } from '@leafer-ui/draw'\n\nimport { scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints } from './scaler'\n\n\n// leaf\nconst leaf = Leaf.prototype as ILeaf, tempPoint = {} as IPointData, tempMatrix = {} as IMatrixData, { copy, scale, toOuterPoint } = MatrixHelper\n\nleaf.scaleResize = function (scaleX: number, scaleY = scaleX, noResize?: boolean, boundsType?: IBoundsType): void {\n const data = this as UI\n if (noResize || (data.editConfig && data.editConfig.editSize === 'scale')) {\n data.scaleX *= scaleX\n data.scaleY *= scaleY\n } else {\n\n if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX\n if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY\n\n if (boundsType === 'stroke') {\n copy(tempMatrix, this.__localMatrix)\n if (scaleX < 0) scale(tempMatrix, -1, 1)\n if (scaleY < 0) scale(tempMatrix, 1, -1)\n\n const { boxBounds, strokeBounds } = this.__layout, { x, y, width, height } = strokeBounds\n tempPoint.x = (x - boxBounds.x) * (scaleX - 1)\n tempPoint.y = (y - boxBounds.y) * (scaleY - 1)\n toOuterPoint(tempMatrix, tempPoint, tempPoint, true)\n this.x += tempPoint.x\n this.y += tempPoint.y\n\n scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width\n scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height\n }\n\n this.__scaleResize(scaleX, scaleY)\n }\n}\n\n\nleaf.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResize(this, scaleX, scaleY)\n}\n\n\nleaf.resizeWidth = function (width: number, relative: ILocationType = 'inner'): void {\n const scale = width / this.getBounds('box', relative).width || 1 // 不允许为0\n this.scaleOf('top-left', scale, this.__.lockRatio ? scale : 1, true)\n}\n\n\nleaf.resizeHeight = function (height: number, relative: ILocationType = 'inner'): void {\n const scale = height / this.getBounds('box', relative).height || 1 // 不允许为0\n this.scaleOf('top-left', this.__.lockRatio ? scale : 1, scale, true)\n}\n\n\n// UI\n\nText.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n const { app, editConfig } = this, editor = app && app.editor, dragPoint = editor && editor.dragPoint\n\n if (this.__.resizeFontSize || (editConfig && editConfig.editSize === 'font-size') || (dragPoint && editor.mergedConfig.editSize === 'font-size')) {\n scaleResizeFontSize(this, scaleX, scaleY, dragPoint && dragPoint.direction)\n } else {\n const { __autoWidth, __autoHeight, textAlign, verticalAlign } = this.__, { boxBounds } = this.__layout\n if (__autoWidth && textAlign !== 'left' && scaleX !== 1) this.x += boxBounds.x\n if (__autoHeight && verticalAlign !== 'top' && scaleY !== 1) this.y += boxBounds.y\n scaleResize(this, scaleX, scaleY)\n }\n}\n\n\nPath.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResizePath(this, scaleX, scaleY)\n}\n\n\nLine.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n if (this.pathInputed) {\n scaleResizePath(this, scaleX, scaleY)\n } else if (this.points) {\n scaleResizePoints(this, scaleX, scaleY)\n } else {\n this.width *= scaleX\n }\n}\n\n\nPolygon.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n if (this.pathInputed) {\n scaleResizePath(this, scaleX, scaleY)\n } else if (this.points) {\n scaleResizePoints(this, scaleX, scaleY)\n } else {\n scaleResize(this, scaleX, scaleY)\n }\n}\n\n\n// group\n\nGroup.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResizeGroup(this, scaleX, scaleY)\n}\n\n\nBox.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n const { resizeChildren, __autoSize } = this.__\n if (!(__autoSize && resizeChildren)) scaleResize(this, scaleX, scaleY)\n if (resizeChildren) scaleResizeGroup(this, scaleX, scaleY)\n}","export { PathScaler } from './PathScaler'\nexport { scaleResize, scaleResizeGroup, scaleResizeFontSize, scaleResizePath, scaleResizePoints } from './scaler'\n\nimport { Plugin } from '@leafer-ui/draw'\n\nimport './resize'\n\nPlugin.add('resize')"],"names":["M","L","C","Q","Z","N","D","X","G","F","O","P","U","Command","PathScaler","scale","data","scaleX","scaleY","command","i","len","length","scalePoints","splice","start","pointCount","end","matrix","MatrixHelper","get","topLeft","top","topRight","right","bottom","left","Direction9","scaleResize","leaf","pathInputed","scaleResizePath","width","height","scaleResizeFontSize","direction","fontScale","isUndefined","layout","__layout","boxBounds","affectScaleOrRotation","moveInner","x","y","fontSize","__","padding","lineHeight","letterSpacing","isArray","map","item","__autoWidth","__autoHeight","isObject","type","value","path","scaleResizePoints","points","forEach","p","scaleResizeGroup","group","children","a","d","transform","Leaf","prototype","tempPoint","tempMatrix","copy","toOuterPoint","noResize","boundsType","this","editConfig","editSize","__localMatrix","strokeBounds","__scaleResize","resizeWidth","relative","getBounds","scaleOf","lockRatio","resizeHeight","Text","app","editor","dragPoint","resizeFontSize","mergedConfig","textAlign","verticalAlign","Path","Line","Polygon","Group","Box","resizeChildren","__autoSize","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/C,YACLC,EAAgB8C,KAAMtE,EAAQC,GACvBqE,KAAKjB,OACZD,EAAkBkB,KAAMtE,EAAQC,GAEhCoB,EAAYiD,KAAMtE,EAAQC,EAElC,EAKA4F,EAAM9B,UAAUY,cAAgB,SAAU3E,EAAgBC,GACtDuD,EAAiBc,KAAMtE,EAAQC,EACnC,EAGA6F,EAAI/B,UAAUY,cAAgB,SAAU3E,EAAgBC,GACpD,MAAM8F,eAAEA,EAAcC,WAAEA,GAAe1B,KAAK/B,GACtCyD,GAAcD,GAAiB1E,EAAYiD,KAAMtE,EAAQC,GAC3D8F,GAAgBvC,EAAiBc,KAAMtE,EAAQC,EACvD,ECxGAgG,EAAOC,IAAI"}
package/dist/resize.js DELETED
@@ -1,246 +0,0 @@
1
- this.LeaferIN = this.LeaferIN || {};
2
-
3
- this.LeaferIN.resize = function(exports, draw) {
4
- "use strict";
5
- const {M: M, L: L, C: C, Q: Q, Z: Z, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = draw.PathCommandMap;
6
- const PathScaler = {
7
- scale(data, scaleX, scaleY) {
8
- if (!data) return;
9
- let command;
10
- let i = 0, len = data.length;
11
- while (i < len) {
12
- command = data[i];
13
- switch (command) {
14
- case M:
15
- case L:
16
- scalePoints(data, scaleX, scaleY, i, 1);
17
- i += 3;
18
- break;
19
-
20
- case C:
21
- scalePoints(data, scaleX, scaleY, i, 3);
22
- i += 7;
23
- break;
24
-
25
- case Q:
26
- scalePoints(data, scaleX, scaleY, i, 2);
27
- i += 5;
28
- break;
29
-
30
- case Z:
31
- i += 1;
32
- break;
33
-
34
- case N:
35
- scalePoints(data, scaleX, scaleY, i, 2);
36
- i += 5;
37
- break;
38
-
39
- case D:
40
- scalePoints(data, scaleX, scaleY, i, 2);
41
- i += 9;
42
- break;
43
-
44
- case X:
45
- scalePoints(data, scaleX, scaleY, i, 2);
46
- i += 6;
47
- break;
48
-
49
- case G:
50
- scalePoints(data, scaleX, scaleY, i, 2);
51
- i += 9;
52
- break;
53
-
54
- case F:
55
- scalePoints(data, scaleX, scaleY, i, 2);
56
- i += 5;
57
- break;
58
-
59
- case O:
60
- data[i] = G;
61
- data.splice(i + 4, 0, data[i + 3], 0);
62
- scalePoints(data, scaleX, scaleY, i, 2);
63
- i += 7 + 2;
64
- len += 2;
65
- break;
66
-
67
- case P:
68
- data[i] = F;
69
- data.splice(i + 4, 0, data[i + 3]);
70
- scalePoints(data, scaleX, scaleY, i, 2);
71
- i += 4 + 1;
72
- len += 1;
73
- break;
74
-
75
- case U:
76
- scalePoints(data, scaleX, scaleY, i, 2);
77
- i += 6;
78
- break;
79
- }
80
- }
81
- },
82
- scalePoints(data, scaleX, scaleY, start, pointCount) {
83
- for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {
84
- data[i] *= scaleX;
85
- data[i + 1] *= scaleY;
86
- }
87
- }
88
- };
89
- const {scalePoints: scalePoints} = PathScaler;
90
- const matrix = draw.MatrixHelper.get();
91
- const {topLeft: topLeft, top: top, topRight: topRight, right: right, bottom: bottom, left: left} = draw.Direction9;
92
- function scaleResize(leaf, scaleX, scaleY) {
93
- if (leaf.pathInputed) {
94
- scaleResizePath(leaf, scaleX, scaleY);
95
- } else {
96
- if (scaleX !== 1) leaf.width *= scaleX;
97
- if (scaleY !== 1) leaf.height *= scaleY;
98
- }
99
- }
100
- function scaleResizeFontSize(leaf, scaleX, scaleY, direction) {
101
- let fontScale = scaleX;
102
- if (!draw.isUndefined(direction)) {
103
- const layout = leaf.__layout;
104
- let {width: width, height: height} = layout.boxBounds;
105
- width *= scaleY - scaleX;
106
- height *= scaleX - scaleY;
107
- switch (direction) {
108
- case top:
109
- case bottom:
110
- fontScale = scaleY;
111
- layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2;
112
- break;
113
-
114
- case left:
115
- case right:
116
- layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2;
117
- break;
118
-
119
- case topLeft:
120
- case topRight:
121
- layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height;
122
- break;
123
- }
124
- }
125
- leaf.fontSize *= fontScale;
126
- const data = leaf.__, {padding: padding, lineHeight: lineHeight, letterSpacing: letterSpacing} = data;
127
- if (padding) leaf.padding = draw.isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale;
128
- if (!data.__autoWidth) leaf.width *= fontScale;
129
- if (!data.__autoHeight) leaf.height *= fontScale;
130
- if (draw.isObject(lineHeight)) {
131
- if (lineHeight.type === "px") data.lineHeight = {
132
- type: "px",
133
- value: lineHeight.value * fontScale
134
- };
135
- } else if (lineHeight) data.lineHeight = lineHeight * fontScale;
136
- if (draw.isObject(letterSpacing)) {
137
- if (letterSpacing.type === "px") data.letterSpacing = {
138
- type: "px",
139
- value: letterSpacing.value * fontScale
140
- };
141
- } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale;
142
- }
143
- function scaleResizePath(leaf, scaleX, scaleY) {
144
- PathScaler.scale(leaf.__.path, scaleX, scaleY);
145
- leaf.path = leaf.__.path;
146
- }
147
- function scaleResizePoints(leaf, scaleX, scaleY) {
148
- const {points: points} = leaf;
149
- draw.isObject(points[0]) ? points.forEach(p => {
150
- p.x *= scaleX, p.y *= scaleY;
151
- }) : PathScaler.scalePoints(points, scaleX, scaleY);
152
- leaf.points = points;
153
- }
154
- function scaleResizeGroup(group, scaleX, scaleY) {
155
- const {children: children} = group;
156
- for (let i = 0; i < children.length; i++) {
157
- matrix.a = scaleX;
158
- matrix.d = scaleY;
159
- children[i].transform(matrix, true);
160
- }
161
- }
162
- const leaf = draw.Leaf.prototype, tempPoint = {}, tempMatrix = {}, {copy: copy, scale: scale, toOuterPoint: toOuterPoint} = draw.MatrixHelper;
163
- leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize, boundsType) {
164
- const data = this;
165
- if (noResize || data.editConfig && data.editConfig.editSize === "scale") {
166
- data.scaleX *= scaleX;
167
- data.scaleY *= scaleY;
168
- } else {
169
- if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX;
170
- if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY;
171
- if (boundsType === "stroke") {
172
- copy(tempMatrix, this.__localMatrix);
173
- if (scaleX < 0) scale(tempMatrix, -1, 1);
174
- if (scaleY < 0) scale(tempMatrix, 1, -1);
175
- const {boxBounds: boxBounds, strokeBounds: strokeBounds} = this.__layout, {x: x, y: y, width: width, height: height} = strokeBounds;
176
- tempPoint.x = (x - boxBounds.x) * (scaleX - 1);
177
- tempPoint.y = (y - boxBounds.y) * (scaleY - 1);
178
- toOuterPoint(tempMatrix, tempPoint, tempPoint, true);
179
- this.x += tempPoint.x;
180
- this.y += tempPoint.y;
181
- scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width;
182
- scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height;
183
- }
184
- this.__scaleResize(scaleX, scaleY);
185
- }
186
- };
187
- leaf.__scaleResize = function(scaleX, scaleY) {
188
- scaleResize(this, scaleX, scaleY);
189
- };
190
- leaf.resizeWidth = function(width, relative = "inner") {
191
- const scale = width / this.getBounds("box", relative).width || 1;
192
- this.scaleOf("top-left", scale, this.__.lockRatio ? scale : 1, true);
193
- };
194
- leaf.resizeHeight = function(height, relative = "inner") {
195
- const scale = height / this.getBounds("box", relative).height || 1;
196
- this.scaleOf("top-left", this.__.lockRatio ? scale : 1, scale, true);
197
- };
198
- draw.Text.prototype.__scaleResize = function(scaleX, scaleY) {
199
- const {app: app, editConfig: editConfig} = this, editor = app && app.editor, dragPoint = editor && editor.dragPoint;
200
- if (this.__.resizeFontSize || editConfig && editConfig.editSize === "font-size" || dragPoint && editor.mergedConfig.editSize === "font-size") {
201
- scaleResizeFontSize(this, scaleX, scaleY, dragPoint && dragPoint.direction);
202
- } else {
203
- const {__autoWidth: __autoWidth, __autoHeight: __autoHeight, textAlign: textAlign, verticalAlign: verticalAlign} = this.__, {boxBounds: boxBounds} = this.__layout;
204
- if (__autoWidth && textAlign !== "left" && scaleX !== 1) this.x += boxBounds.x;
205
- if (__autoHeight && verticalAlign !== "top" && scaleY !== 1) this.y += boxBounds.y;
206
- scaleResize(this, scaleX, scaleY);
207
- }
208
- };
209
- draw.Path.prototype.__scaleResize = function(scaleX, scaleY) {
210
- scaleResizePath(this, scaleX, scaleY);
211
- };
212
- draw.Line.prototype.__scaleResize = function(scaleX, scaleY) {
213
- if (this.pathInputed) {
214
- scaleResizePath(this, scaleX, scaleY);
215
- } else if (this.points) {
216
- scaleResizePoints(this, scaleX, scaleY);
217
- } else {
218
- this.width *= scaleX;
219
- }
220
- };
221
- draw.Polygon.prototype.__scaleResize = function(scaleX, scaleY) {
222
- if (this.pathInputed) {
223
- scaleResizePath(this, scaleX, scaleY);
224
- } else if (this.points) {
225
- scaleResizePoints(this, scaleX, scaleY);
226
- } else {
227
- scaleResize(this, scaleX, scaleY);
228
- }
229
- };
230
- draw.Group.prototype.__scaleResize = function(scaleX, scaleY) {
231
- scaleResizeGroup(this, scaleX, scaleY);
232
- };
233
- draw.Box.prototype.__scaleResize = function(scaleX, scaleY) {
234
- const {resizeChildren: resizeChildren, __autoSize: __autoSize} = this.__;
235
- if (!(__autoSize && resizeChildren)) scaleResize(this, scaleX, scaleY);
236
- if (resizeChildren) scaleResizeGroup(this, scaleX, scaleY);
237
- };
238
- draw.Plugin.add("resize");
239
- exports.PathScaler = PathScaler;
240
- exports.scaleResize = scaleResize;
241
- exports.scaleResizeFontSize = scaleResizeFontSize;
242
- exports.scaleResizeGroup = scaleResizeGroup;
243
- exports.scaleResizePath = scaleResizePath;
244
- exports.scaleResizePoints = scaleResizePoints;
245
- return exports;
246
- }({}, LeaferUI);
@@ -1,2 +0,0 @@
1
- "use strict";var e=require("@leafer-ui/draw");const{M:t,L:i,C:s,Q:o,Z:a,N:n,D:c,X:h,G:r,F:l,O:p,P:_,U:f}=e.PathCommandMap,u={scale(e,u,g){if(!e)return;let x,z=0,y=e.length;for(;z<y;)switch(x=e[z],x){case t:case i:d(e,u,g,z,1),z+=3;break;case s:d(e,u,g,z,3),z+=7;break;case o:d(e,u,g,z,2),z+=5;break;case a:z+=1;break;case n:d(e,u,g,z,2),z+=5;break;case c:d(e,u,g,z,2),z+=9;break;case h:d(e,u,g,z,2),z+=6;break;case r:d(e,u,g,z,2),z+=9;break;case l:d(e,u,g,z,2),z+=5;break;case p:e[z]=r,e.splice(z+4,0,e[z+3],0),d(e,u,g,z,2),z+=9,y+=2;break;case _:e[z]=l,e.splice(z+4,0,e[z+3]),d(e,u,g,z,2),z+=5,y+=1;break;case f:d(e,u,g,z,2),z+=6}},scalePoints(e,t,i,s,o){for(let a=o?s+1:0,n=o?a+2*o:e.length;a<n;a+=2)e[a]*=t,e[a+1]*=i}},{scalePoints:d}=u,g=e.MatrixHelper.get(),{topLeft:x,top:z,topRight:y,right:b,bottom:R,left:k}=e.Direction9;function S(e,t,i){e.pathInputed?w(e,t,i):(1!==t&&(e.width*=t),1!==i&&(e.height*=i))}function P(t,i,s,o){let a=i;if(!e.isUndefined(o)){const e=t.__layout;let{width:n,height:c}=e.boxBounds;switch(n*=s-i,c*=i-s,o){case z:case R:a=s,e.affectScaleOrRotation?t.moveInner(-n/2,0):t.x-=n/2;break;case k:case b:e.affectScaleOrRotation?t.moveInner(0,-c/2):t.y-=c/2;break;case x:case y:e.affectScaleOrRotation?t.moveInner(0,-c):t.y-=c}}t.fontSize*=a;const n=t.__,{padding:c,lineHeight:h,letterSpacing:r}=n;c&&(t.padding=e.isArray(c)?c.map(e=>e*a):c*a),n.__autoWidth||(t.width*=a),n.__autoHeight||(t.height*=a),e.isObject(h)?"px"===h.type&&(n.lineHeight={type:"px",value:h.value*a}):h&&(n.lineHeight=h*a),e.isObject(r)?"px"===r.type&&(n.letterSpacing={type:"px",value:r.value*a}):r&&(n.letterSpacing=r*a)}function w(e,t,i){u.scale(e.__.path,t,i),e.path=e.__.path}function O(t,i,s){const{points:o}=t;e.isObject(o[0])?o.forEach(e=>{e.x*=i,e.y*=s}):u.scalePoints(o,i,s),t.points=o}function m(e,t,i){const{children:s}=e;for(let e=0;e<s.length;e++)g.a=t,g.d=i,s[e].transform(g,!0)}const v=e.Leaf.prototype,H={},B={},{copy:C,scale:I,toOuterPoint:M}=e.MatrixHelper;v.scaleResize=function(e,t=e,i,s){const o=this;if(i||o.editConfig&&"scale"===o.editConfig.editSize)o.scaleX*=e,o.scaleY*=t;else{if(e<0&&(o.scaleX*=-1,e=-e),t<0&&(o.scaleY*=-1,t=-t),"stroke"===s){C(B,this.__localMatrix),e<0&&I(B,-1,1),t<0&&I(B,1,-1);const{boxBounds:i,strokeBounds:s}=this.__layout,{x:o,y:a,width:n,height:c}=s;H.x=(o-i.x)*(e-1),H.y=(a-i.y)*(t-1),M(B,H,H,!0),this.x+=H.x,this.y+=H.y,e=(n*e-(n-i.width))/i.width,t=(c*t-(c-i.height))/i.height}this.__scaleResize(e,t)}},v.__scaleResize=function(e,t){S(this,e,t)},v.resizeWidth=function(e,t="inner"){const i=e/this.getBounds("box",t).width||1;this.scaleOf("top-left",i,this.__.lockRatio?i:1,!0)},v.resizeHeight=function(e,t="inner"){const i=e/this.getBounds("box",t).height||1;this.scaleOf("top-left",this.__.lockRatio?i:1,i,!0)},e.Text.prototype.__scaleResize=function(e,t){const{app:i,editConfig:s}=this,o=i&&i.editor,a=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||a&&"font-size"===o.mergedConfig.editSize)P(this,e,t,a&&a.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:a}=this.__,{boxBounds:n}=this.__layout;i&&"left"!==o&&1!==e&&(this.x+=n.x),s&&"top"!==a&&1!==t&&(this.y+=n.y),S(this,e,t)}},e.Path.prototype.__scaleResize=function(e,t){w(this,e,t)},e.Line.prototype.__scaleResize=function(e,t){this.pathInputed?w(this,e,t):this.points?O(this,e,t):this.width*=e},e.Polygon.prototype.__scaleResize=function(e,t){this.pathInputed?w(this,e,t):this.points?O(this,e,t):S(this,e,t)},e.Group.prototype.__scaleResize=function(e,t){m(this,e,t)},e.Box.prototype.__scaleResize=function(e,t){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||S(this,e,t),i&&m(this,e,t)},e.Plugin.add("resize"),exports.PathScaler=u,exports.scaleResize=S,exports.scaleResizeFontSize=P,exports.scaleResizeGroup=m,exports.scaleResizePath=w,exports.scaleResizePoints=O;
2
- //# sourceMappingURL=resize.min.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resize.min.cjs","sources":["../../../../../../src/in/packages/resize/src/PathScaler.ts","../../../../../../src/in/packages/resize/src/scaler.ts","../../../../../../src/in/packages/resize/src/resize.ts","../../../../../../src/in/packages/resize/src/index.ts"],"sourcesContent":["import { IPathCommandData } from '@leafer-ui/interface'\n\nimport { PathCommandMap as Command } from '@leafer-ui/draw'\n\n\nconst { M, L, C, Q, Z, N, D, X, G, F, O, P, U } = Command\n\nexport const PathScaler = {\n\n scale(data: IPathCommandData, scaleX: number, scaleY: number): void {\n if (!data) return\n\n let command: number\n let i = 0, len = data.length\n\n while (i < len) {\n command = data[i]\n switch (command) {\n case M: //moveto(x, y)\n case L: //lineto(x, y)\n scalePoints(data, scaleX, scaleY, i, 1)\n i += 3\n break\n case C: //bezierCurveTo(x1, y1, x2, y2, x, y)\n scalePoints(data, scaleX, scaleY, i, 3)\n i += 7\n break\n case Q: //quadraticCurveTo(x1, y1, x, y)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case Z: //closepath()\n i += 1\n break\n\n // canvas command\n\n case N: // rect(x, y, width, height)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case D: // roundRect(x, y, width, height, radius1, radius2, radius3, radius4)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 9\n break\n case X: // simple roundRect(x, y, width, height, radius)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 6\n break\n case G: // ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 9\n break\n case F: // simple ellipse(x, y, radiusX, radiusY)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case O: // arc(x, y, radius, startAngle, endAngle, anticlockwise)\n data[i] = G // to ellipse\n data.splice(i + 4, 0, data[i + 3], 0)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 7 + 2\n len += 2\n break\n case P: // simple arc(x, y, radius)\n data[i] = F // to simple ellipse\n data.splice(i + 4, 0, data[i + 3])\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 4 + 1\n len += 1\n break\n case U: // arcTo(x1, y1, x2, y2, radius)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 6\n break\n }\n }\n\n },\n\n scalePoints(data: IPathCommandData, scaleX: number, scaleY: number, start?: number, pointCount?: number): void {\n for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {\n data[i] *= scaleX\n data[i + 1] *= scaleY\n }\n }\n\n}\n\nconst { scalePoints } = PathScaler","import { IBranch, ILeaf, ILine, IPolygon, IText, IPointData } from '@leafer-ui/interface'\nimport { Direction9, MatrixHelper, isArray, isObject, isUndefined } from '@leafer-ui/draw'\n\nimport { PathScaler } from './PathScaler'\n\n\nconst matrix = MatrixHelper.get()\nconst { topLeft, top, topRight, right, bottom, left } = Direction9\n\nexport function scaleResize(leaf: ILeaf, scaleX: number, scaleY: number): void {\n if (leaf.pathInputed) {\n scaleResizePath(leaf, scaleX, scaleY)\n } else {\n // fix: Text / Box auto width / height, need check scale === 1\n if (scaleX !== 1) leaf.width *= scaleX\n if (scaleY !== 1) leaf.height *= scaleY\n }\n}\n\nexport function scaleResizeFontSize(leaf: IText, scaleX: number, scaleY: number, direction?: Direction9): void {\n let fontScale = scaleX\n\n if (!isUndefined(direction)) {\n\n const layout = leaf.__layout\n\n let { width, height } = layout.boxBounds\n width *= scaleY - scaleX\n height *= scaleX - scaleY\n\n switch (direction) { // 编辑器控制点的位置\n case top:\n case bottom:\n fontScale = scaleY\n layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2\n break\n case left:\n case right:\n layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2\n break\n case topLeft:\n case topRight:\n layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height\n break\n }\n\n }\n\n leaf.fontSize *= fontScale\n\n const data = leaf.__, { padding, lineHeight, letterSpacing } = data\n if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale\n if (!data.__autoWidth) leaf.width *= fontScale\n if (!data.__autoHeight) leaf.height *= fontScale\n\n if (isObject(lineHeight)) {\n if (lineHeight.type === 'px') data.lineHeight = { type: 'px', value: lineHeight.value * fontScale }\n } else if (lineHeight) data.lineHeight = lineHeight * fontScale\n\n if (isObject(letterSpacing)) {\n if (letterSpacing.type === 'px') data.letterSpacing = { type: 'px', value: letterSpacing.value * fontScale }\n } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale\n\n}\n\nexport function scaleResizePath(leaf: ILeaf, scaleX: number, scaleY: number): void {\n PathScaler.scale(leaf.__.path, scaleX, scaleY)\n leaf.path = leaf.__.path\n}\n\nexport function scaleResizePoints(leaf: ILine | IPolygon, scaleX: number, scaleY: number): void {\n const { points } = leaf\n isObject(points[0]) ? (points as IPointData[]).forEach(p => { p.x *= scaleX, p.y *= scaleY }) : PathScaler.scalePoints(points as number[], scaleX, scaleY)\n leaf.points = points\n}\n\n\nexport function scaleResizeGroup(group: IBranch, scaleX: number, scaleY: number): void {\n const { children } = group\n for (let i = 0; i < children.length; i++) {\n matrix.a = scaleX // must update\n matrix.d = scaleY\n children[i].transform(matrix, true)\n }\n}","import { IBoundsType, ILeaf, IPointData, IMatrixData, ILocationType } from '@leafer-ui/interface'\nimport { Leaf, Path, Line, Text, Polygon, Group, Box, UI, MatrixHelper } from '@leafer-ui/draw'\n\nimport { scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints } from './scaler'\n\n\n// leaf\nconst leaf = Leaf.prototype as ILeaf, tempPoint = {} as IPointData, tempMatrix = {} as IMatrixData, { copy, scale, toOuterPoint } = MatrixHelper\n\nleaf.scaleResize = function (scaleX: number, scaleY = scaleX, noResize?: boolean, boundsType?: IBoundsType): void {\n const data = this as UI\n if (noResize || (data.editConfig && data.editConfig.editSize === 'scale')) {\n data.scaleX *= scaleX\n data.scaleY *= scaleY\n } else {\n\n if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX\n if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY\n\n if (boundsType === 'stroke') {\n copy(tempMatrix, this.__localMatrix)\n if (scaleX < 0) scale(tempMatrix, -1, 1)\n if (scaleY < 0) scale(tempMatrix, 1, -1)\n\n const { boxBounds, strokeBounds } = this.__layout, { x, y, width, height } = strokeBounds\n tempPoint.x = (x - boxBounds.x) * (scaleX - 1)\n tempPoint.y = (y - boxBounds.y) * (scaleY - 1)\n toOuterPoint(tempMatrix, tempPoint, tempPoint, true)\n this.x += tempPoint.x\n this.y += tempPoint.y\n\n scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width\n scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height\n }\n\n this.__scaleResize(scaleX, scaleY)\n }\n}\n\n\nleaf.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResize(this, scaleX, scaleY)\n}\n\n\nleaf.resizeWidth = function (width: number, relative: ILocationType = 'inner'): void {\n const scale = width / this.getBounds('box', relative).width || 1 // 不允许为0\n this.scaleOf('top-left', scale, this.__.lockRatio ? scale : 1, true)\n}\n\n\nleaf.resizeHeight = function (height: number, relative: ILocationType = 'inner'): void {\n const scale = height / this.getBounds('box', relative).height || 1 // 不允许为0\n this.scaleOf('top-left', this.__.lockRatio ? scale : 1, scale, true)\n}\n\n\n// UI\n\nText.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n const { app, editConfig } = this, editor = app && app.editor, dragPoint = editor && editor.dragPoint\n\n if (this.__.resizeFontSize || (editConfig && editConfig.editSize === 'font-size') || (dragPoint && editor.mergedConfig.editSize === 'font-size')) {\n scaleResizeFontSize(this, scaleX, scaleY, dragPoint && dragPoint.direction)\n } else {\n const { __autoWidth, __autoHeight, textAlign, verticalAlign } = this.__, { boxBounds } = this.__layout\n if (__autoWidth && textAlign !== 'left' && scaleX !== 1) this.x += boxBounds.x\n if (__autoHeight && verticalAlign !== 'top' && scaleY !== 1) this.y += boxBounds.y\n scaleResize(this, scaleX, scaleY)\n }\n}\n\n\nPath.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResizePath(this, scaleX, scaleY)\n}\n\n\nLine.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n if (this.pathInputed) {\n scaleResizePath(this, scaleX, scaleY)\n } else if (this.points) {\n scaleResizePoints(this, scaleX, scaleY)\n } else {\n this.width *= scaleX\n }\n}\n\n\nPolygon.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n if (this.pathInputed) {\n scaleResizePath(this, scaleX, scaleY)\n } else if (this.points) {\n scaleResizePoints(this, scaleX, scaleY)\n } else {\n scaleResize(this, scaleX, scaleY)\n }\n}\n\n\n// group\n\nGroup.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResizeGroup(this, scaleX, scaleY)\n}\n\n\nBox.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n const { resizeChildren, __autoSize } = this.__\n if (!(__autoSize && resizeChildren)) scaleResize(this, scaleX, scaleY)\n if (resizeChildren) scaleResizeGroup(this, scaleX, scaleY)\n}","export { PathScaler } from './PathScaler'\nexport { scaleResize, scaleResizeGroup, scaleResizeFontSize, scaleResizePath, scaleResizePoints } from './scaler'\n\nimport { Plugin } from '@leafer-ui/draw'\n\nimport './resize'\n\nPlugin.add('resize')"],"names":["M","L","C","Q","Z","N","D","X","G","F","O","P","U","Command","PathScaler","scale","data","scaleX","scaleY","command","i","len","length","scalePoints","splice","start","pointCount","end","matrix","MatrixHelper","get","topLeft","top","topRight","right","bottom","left","Direction9","scaleResize","leaf","pathInputed","scaleResizePath","width","height","scaleResizeFontSize","direction","fontScale","isUndefined","layout","__layout","boxBounds","affectScaleOrRotation","moveInner","x","y","fontSize","__","padding","lineHeight","letterSpacing","isArray","map","item","__autoWidth","__autoHeight","isObject","type","value","path","scaleResizePoints","points","forEach","p","scaleResizeGroup","group","children","a","d","transform","Leaf","prototype","tempPoint","tempMatrix","copy","toOuterPoint","noResize","boundsType","this","editConfig","editSize","__localMatrix","strokeBounds","__scaleResize","resizeWidth","relative","getBounds","scaleOf","lockRatio","resizeHeight","Text","app","editor","dragPoint","resizeFontSize","mergedConfig","textAlign","verticalAlign","Path","Line","Polygon","Group","Box","resizeChildren","__autoSize","Plugin","add"],"mappings":"8CAKA,MAAMA,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,GAAMC,EAAAA,eAErCC,EAAa,CAEtB,KAAAC,CAAMC,EAAwBC,EAAgBC,GAC1C,IAAKF,EAAM,OAEX,IAAIG,EACAC,EAAI,EAAGC,EAAML,EAAKM,OAEtB,KAAOF,EAAIC,GAEP,OADAF,EAAUH,EAAKI,GACPD,GACJ,KAAKnB,EACL,KAAKC,EACDsB,EAAYP,EAAMC,EAAQC,EAAQE,EAAG,GACrCA,GAAK,EACL,MACJ,KAAKlB,EACDqB,EAAYP,EAAMC,EAAQC,EAAQE,EAAG,GACrCA,GAAK,EACL,MACJ,KAAKjB,EACDoB,EAAYP,EAAMC,EAAQC,EAAQE,EAAG,GACrCA,GAAK,EACL,MACJ,KAAKhB,EACDgB,GAAK,EACL,MAIJ,KAAKf,EACDkB,EAAYP,EAAMC,EAAQC,EAAQE,EAAG,GACrCA,GAAK,EAC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y=0,x=e.length;for(;y<x;)switch(z=e[y],z){case i:case s:g(e,t,d,y,1),y+=3;break;case o:g(e,t,d,y,3),y+=7;break;case a:g(e,t,d,y,2),y+=5;break;case n:y+=1;break;case c:g(e,t,d,y,2),y+=5;break;case h:g(e,t,d,y,2),y+=9;break;case r:g(e,t,d,y,2),y+=6;break;case l:g(e,t,d,y,2),y+=9;break;case p:g(e,t,d,y,2),y+=5;break;case f:e[y]=l,e.splice(y+4,0,e[y+3],0),g(e,t,d,y,2),y+=9,x+=2;break;case _:e[y]=p,e.splice(y+4,0,e[y+3]),g(e,t,d,y,2),y+=5,x+=1;break;case u:g(e,t,d,y,2),y+=6}},scalePoints(e,t,i,s,o){for(let a=o?s+1:0,n=o?a+2*o:e.length;a<n;a+=2)e[a]*=t,e[a+1]*=i}},{scalePoints:g}=d,z=t.MatrixHelper.get(),{topLeft:y,top:x,topRight:b,right:R,bottom:k,left:S}=t.Direction9;function P(e,t,i){e.pathInputed?I(e,t,i):(1!==t&&(e.width*=t),1!==i&&(e.height*=i))}function w(e,i,s,o){let a=i;if(!t.isUndefined(o)){const t=e.__layout;let{width:n,height:c}=t.boxBounds;switch(n*=s-i,c*=i-s,o){case x:case k:a=s,t.affectScaleOrRotation?e.moveInner(-n/2,0):e.x-=n/2;break;case S:case R:t.affectScaleOrRotation?e.moveInner(0,-c/2):e.y-=c/2;break;case y:case b:t.affectScaleOrRotation?e.moveInner(0,-c):e.y-=c}}e.fontSize*=a;const n=e.__,{padding:c,lineHeight:h,letterSpacing:r}=n;c&&(e.padding=t.isArray(c)?c.map(e=>e*a):c*a),n.__autoWidth||(e.width*=a),n.__autoHeight||(e.height*=a),t.isObject(h)?"px"===h.type&&(n.lineHeight={type:"px",value:h.value*a}):h&&(n.lineHeight=h*a),t.isObject(r)?"px"===r.type&&(n.letterSpacing={type:"px",value:r.value*a}):r&&(n.letterSpacing=r*a)}function I(e,t,i){d.scale(e.__.path,t,i),e.path=e.__.path}function O(e,i,s){const{points:o}=e;t.isObject(o[0])?o.forEach(e=>{e.x*=i,e.y*=s}):d.scalePoints(o,i,s),e.points=o}function m(e,t,i){const{children:s}=e;for(let e=0;e<s.length;e++)z.a=t,z.d=i,s[e].transform(z,!0)}const v=t.Leaf.prototype,H={},L={},{copy:B,scale:C,toOuterPoint:M}=t.MatrixHelper;return v.scaleResize=function(e,t=e,i,s){const o=this;if(i||o.editConfig&&"scale"===o.editConfig.editSize)o.scaleX*=e,o.scaleY*=t;else{if(e<0&&(o.scaleX*=-1,e=-e),t<0&&(o.scaleY*=-1,t=-t),"stroke"===s){B(L,this.__localMatrix),e<0&&C(L,-1,1),t<0&&C(L,1,-1);const{boxBounds:i,strokeBounds:s}=this.__layout,{x:o,y:a,width:n,height:c}=s;H.x=(o-i.x)*(e-1),H.y=(a-i.y)*(t-1),M(L,H,H,!0),this.x+=H.x,this.y+=H.y,e=(n*e-(n-i.width))/i.width,t=(c*t-(c-i.height))/i.height}this.__scaleResize(e,t)}},v.__scaleResize=function(e,t){P(this,e,t)},v.resizeWidth=function(e,t="inner"){const i=e/this.getBounds("box",t).width||1;this.scaleOf("top-left",i,this.__.lockRatio?i:1,!0)},v.resizeHeight=function(e,t="inner"){const i=e/this.getBounds("box",t).height||1;this.scaleOf("top-left",this.__.lockRatio?i:1,i,!0)},t.Text.prototype.__scaleResize=function(e,t){const{app:i,editConfig:s}=this,o=i&&i.editor,a=o&&o.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||a&&"font-size"===o.mergedConfig.editSize)w(this,e,t,a&&a.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:o,verticalAlign:a}=this.__,{boxBounds:n}=this.__layout;i&&"left"!==o&&1!==e&&(this.x+=n.x),s&&"top"!==a&&1!==t&&(this.y+=n.y),P(this,e,t)}},t.Path.prototype.__scaleResize=function(e,t){I(this,e,t)},t.Line.prototype.__scaleResize=function(e,t){this.pathInputed?I(this,e,t):this.points?O(this,e,t):this.width*=e},t.Polygon.prototype.__scaleResize=function(e,t){this.pathInputed?I(this,e,t):this.points?O(this,e,t):P(this,e,t)},t.Group.prototype.__scaleResize=function(e,t){m(this,e,t)},t.Box.prototype.__scaleResize=function(e,t){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||P(this,e,t),i&&m(this,e,t)},t.Plugin.add("resize"),e.PathScaler=d,e.scaleResize=P,e.scaleResizeFontSize=w,e.scaleResizeGroup=m,e.scaleResizePath=I,e.scaleResizePoints=O,e}({},LeaferUI);
2
- //# sourceMappingURL=resize.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resize.min.js","sources":["../../../../../../src/in/packages/resize/src/PathScaler.ts","../../../../../../src/in/packages/resize/src/scaler.ts","../../../../../../src/in/packages/resize/src/resize.ts","../../../../../../src/in/packages/resize/src/index.ts"],"sourcesContent":["import { IPathCommandData } from '@leafer-ui/interface'\n\nimport { PathCommandMap as Command } from '@leafer-ui/draw'\n\n\nconst { M, L, C, Q, Z, N, D, X, G, F, O, P, U } = Command\n\nexport const PathScaler = {\n\n scale(data: IPathCommandData, scaleX: number, scaleY: number): void {\n if (!data) return\n\n let command: number\n let i = 0, len = data.length\n\n while (i < len) {\n command = data[i]\n switch (command) {\n case M: //moveto(x, y)\n case L: //lineto(x, y)\n scalePoints(data, scaleX, scaleY, i, 1)\n i += 3\n break\n case C: //bezierCurveTo(x1, y1, x2, y2, x, y)\n scalePoints(data, scaleX, scaleY, i, 3)\n i += 7\n break\n case Q: //quadraticCurveTo(x1, y1, x, y)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case Z: //closepath()\n i += 1\n break\n\n // canvas command\n\n case N: // rect(x, y, width, height)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case D: // roundRect(x, y, width, height, radius1, radius2, radius3, radius4)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 9\n break\n case X: // simple roundRect(x, y, width, height, radius)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 6\n break\n case G: // ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 9\n break\n case F: // simple ellipse(x, y, radiusX, radiusY)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 5\n break\n case O: // arc(x, y, radius, startAngle, endAngle, anticlockwise)\n data[i] = G // to ellipse\n data.splice(i + 4, 0, data[i + 3], 0)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 7 + 2\n len += 2\n break\n case P: // simple arc(x, y, radius)\n data[i] = F // to simple ellipse\n data.splice(i + 4, 0, data[i + 3])\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 4 + 1\n len += 1\n break\n case U: // arcTo(x1, y1, x2, y2, radius)\n scalePoints(data, scaleX, scaleY, i, 2)\n i += 6\n break\n }\n }\n\n },\n\n scalePoints(data: IPathCommandData, scaleX: number, scaleY: number, start?: number, pointCount?: number): void {\n for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {\n data[i] *= scaleX\n data[i + 1] *= scaleY\n }\n }\n\n}\n\nconst { scalePoints } = PathScaler","import { IBranch, ILeaf, ILine, IPolygon, IText, IPointData } from '@leafer-ui/interface'\nimport { Direction9, MatrixHelper, isArray, isObject, isUndefined } from '@leafer-ui/draw'\n\nimport { PathScaler } from './PathScaler'\n\n\nconst matrix = MatrixHelper.get()\nconst { topLeft, top, topRight, right, bottom, left } = Direction9\n\nexport function scaleResize(leaf: ILeaf, scaleX: number, scaleY: number): void {\n if (leaf.pathInputed) {\n scaleResizePath(leaf, scaleX, scaleY)\n } else {\n // fix: Text / Box auto width / height, need check scale === 1\n if (scaleX !== 1) leaf.width *= scaleX\n if (scaleY !== 1) leaf.height *= scaleY\n }\n}\n\nexport function scaleResizeFontSize(leaf: IText, scaleX: number, scaleY: number, direction?: Direction9): void {\n let fontScale = scaleX\n\n if (!isUndefined(direction)) {\n\n const layout = leaf.__layout\n\n let { width, height } = layout.boxBounds\n width *= scaleY - scaleX\n height *= scaleX - scaleY\n\n switch (direction) { // 编辑器控制点的位置\n case top:\n case bottom:\n fontScale = scaleY\n layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2\n break\n case left:\n case right:\n layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2\n break\n case topLeft:\n case topRight:\n layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height\n break\n }\n\n }\n\n leaf.fontSize *= fontScale\n\n const data = leaf.__, { padding, lineHeight, letterSpacing } = data\n if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale\n if (!data.__autoWidth) leaf.width *= fontScale\n if (!data.__autoHeight) leaf.height *= fontScale\n\n if (isObject(lineHeight)) {\n if (lineHeight.type === 'px') data.lineHeight = { type: 'px', value: lineHeight.value * fontScale }\n } else if (lineHeight) data.lineHeight = lineHeight * fontScale\n\n if (isObject(letterSpacing)) {\n if (letterSpacing.type === 'px') data.letterSpacing = { type: 'px', value: letterSpacing.value * fontScale }\n } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale\n\n}\n\nexport function scaleResizePath(leaf: ILeaf, scaleX: number, scaleY: number): void {\n PathScaler.scale(leaf.__.path, scaleX, scaleY)\n leaf.path = leaf.__.path\n}\n\nexport function scaleResizePoints(leaf: ILine | IPolygon, scaleX: number, scaleY: number): void {\n const { points } = leaf\n isObject(points[0]) ? (points as IPointData[]).forEach(p => { p.x *= scaleX, p.y *= scaleY }) : PathScaler.scalePoints(points as number[], scaleX, scaleY)\n leaf.points = points\n}\n\n\nexport function scaleResizeGroup(group: IBranch, scaleX: number, scaleY: number): void {\n const { children } = group\n for (let i = 0; i < children.length; i++) {\n matrix.a = scaleX // must update\n matrix.d = scaleY\n children[i].transform(matrix, true)\n }\n}","import { IBoundsType, ILeaf, IPointData, IMatrixData, ILocationType } from '@leafer-ui/interface'\nimport { Leaf, Path, Line, Text, Polygon, Group, Box, UI, MatrixHelper } from '@leafer-ui/draw'\n\nimport { scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints } from './scaler'\n\n\n// leaf\nconst leaf = Leaf.prototype as ILeaf, tempPoint = {} as IPointData, tempMatrix = {} as IMatrixData, { copy, scale, toOuterPoint } = MatrixHelper\n\nleaf.scaleResize = function (scaleX: number, scaleY = scaleX, noResize?: boolean, boundsType?: IBoundsType): void {\n const data = this as UI\n if (noResize || (data.editConfig && data.editConfig.editSize === 'scale')) {\n data.scaleX *= scaleX\n data.scaleY *= scaleY\n } else {\n\n if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX\n if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY\n\n if (boundsType === 'stroke') {\n copy(tempMatrix, this.__localMatrix)\n if (scaleX < 0) scale(tempMatrix, -1, 1)\n if (scaleY < 0) scale(tempMatrix, 1, -1)\n\n const { boxBounds, strokeBounds } = this.__layout, { x, y, width, height } = strokeBounds\n tempPoint.x = (x - boxBounds.x) * (scaleX - 1)\n tempPoint.y = (y - boxBounds.y) * (scaleY - 1)\n toOuterPoint(tempMatrix, tempPoint, tempPoint, true)\n this.x += tempPoint.x\n this.y += tempPoint.y\n\n scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width\n scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height\n }\n\n this.__scaleResize(scaleX, scaleY)\n }\n}\n\n\nleaf.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResize(this, scaleX, scaleY)\n}\n\n\nleaf.resizeWidth = function (width: number, relative: ILocationType = 'inner'): void {\n const scale = width / this.getBounds('box', relative).width || 1 // 不允许为0\n this.scaleOf('top-left', scale, this.__.lockRatio ? scale : 1, true)\n}\n\n\nleaf.resizeHeight = function (height: number, relative: ILocationType = 'inner'): void {\n const scale = height / this.getBounds('box', relative).height || 1 // 不允许为0\n this.scaleOf('top-left', this.__.lockRatio ? scale : 1, scale, true)\n}\n\n\n// UI\n\nText.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n const { app, editConfig } = this, editor = app && app.editor, dragPoint = editor && editor.dragPoint\n\n if (this.__.resizeFontSize || (editConfig && editConfig.editSize === 'font-size') || (dragPoint && editor.mergedConfig.editSize === 'font-size')) {\n scaleResizeFontSize(this, scaleX, scaleY, dragPoint && dragPoint.direction)\n } else {\n const { __autoWidth, __autoHeight, textAlign, verticalAlign } = this.__, { boxBounds } = this.__layout\n if (__autoWidth && textAlign !== 'left' && scaleX !== 1) this.x += boxBounds.x\n if (__autoHeight && verticalAlign !== 'top' && scaleY !== 1) this.y += boxBounds.y\n scaleResize(this, scaleX, scaleY)\n }\n}\n\n\nPath.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResizePath(this, scaleX, scaleY)\n}\n\n\nLine.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n if (this.pathInputed) {\n scaleResizePath(this, scaleX, scaleY)\n } else if (this.points) {\n scaleResizePoints(this, scaleX, scaleY)\n } else {\n this.width *= scaleX\n }\n}\n\n\nPolygon.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n if (this.pathInputed) {\n scaleResizePath(this, scaleX, scaleY)\n } else if (this.points) {\n scaleResizePoints(this, scaleX, scaleY)\n } else {\n scaleResize(this, scaleX, scaleY)\n }\n}\n\n\n// group\n\nGroup.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n scaleResizeGroup(this, scaleX, scaleY)\n}\n\n\nBox.prototype.__scaleResize = function (scaleX: number, scaleY: number): void {\n const { resizeChildren, __autoSize } = this.__\n if (!(__autoSize && resizeChildren)) scaleResize(this, scaleX, scaleY)\n if (resizeChildren) scaleResizeGroup(this, scaleX, scaleY)\n}","export { PathScaler } from './PathScaler'\nexport { scaleResize, scaleResizeGroup, scaleResizeFontSize, scaleResizePath, scaleResizePoints } from './scaler'\n\nimport { Plugin } from '@leafer-ui/draw'\n\nimport './resize'\n\nPlugin.add('resize')"],"names":["M","L","C","Q","Z","N","D","X","G","F","O","P","U","Command","PathScaler","scale","data","scaleX","scaleY","command","i","len","length","scalePoints","splice","start","pointCount","end","matrix","MatrixHelper","get","topLeft","top","topRight","right","bottom","left","Direction9","scaleResize","leaf","pathInputed","scaleResizePath","width","height","scaleResizeFontSize","direction","fontScale","isUndefined","layout","__layout","boxBounds","affectScaleOrRotation","moveInner","x","y","fontSize","__","padding","lineHeight","letterSpacing","isArray","map","item","__autoWidth","__autoHeight","isObject","type","value","path","scaleResizePoints","points","forEach","p","scaleResizeGroup","group","children","a","d","transform","Leaf","prototype","tempPoint","tempMatrix","copy","toOuterPoint","noResize","boundsType","this","editConfig","editSize","__localMatrix","strokeBounds","__scaleResize","resizeWidth","relative","getBounds","scaleOf","lockRatio","resizeHeight","Text","app","editor","dragPoint","resizeFontSize","mergedConfig","textAlign","verticalAlign","Path","Line","Polygon","Group","Box","resizeChildren","__autoSize","Plugin","add"],"mappings":"gFAKA,MAAMA,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,EAACC,EAAEA,GAAMC,EAAAA,eAErCC,EAAa,CAEtB,KAAAC,CAAMC,EAAwBC,EAAgBC,GAC1C,IAAKF,EAAM,OAEX,IAAIG,EACAC,EAAI,EAAGC,EAAML,EAAKM,OAEtB,KAAOF,EAAIC,GAEP,OADAF,EAAUH,EAAKI,GACPD,GACJ,KAAKnB,EACL,KAAKC,EACDsB,EAAYP,EAAMC,EAAQC,EAAQE,EAAG,GACrCA,GAAK,EACL,MACJ,KAAKlB,EACDqB,EAAYP,EAAMC,EAAQC,EAAQE,EAAG,GACrCA,GAAK,EACL,MACJ,KAAKjB,EACDoB,EAAYP,EAAMC,EAAQC,EAAQE,EAAG,GACrCA,GAAK,EACL,MACJ,KAAKhB,EACDgB,GAAK,EACL,MAIJ,KAAKf,EACDkB,EAAYP,EAAMC,EAAQC,EAA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