leafer-ui 1.0.0-rc.2 → 1.0.0-rc.3
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/README.md +1 -1
- package/dist/web.esm.js +33 -22
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +46 -25
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +46 -25
- package/dist/web.module.min.js +1 -1
- package/package.json +4 -4
- package/types/index.d.ts +1 -1
package/dist/web.module.js
CHANGED
|
@@ -1048,6 +1048,9 @@ const EventCreator = {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
1050
|
},
|
|
1051
|
+
has(type) {
|
|
1052
|
+
return !!this.nameList[type];
|
|
1053
|
+
},
|
|
1051
1054
|
get(type, ...params) {
|
|
1052
1055
|
return new nameList[type](...params);
|
|
1053
1056
|
}
|
|
@@ -5158,6 +5161,8 @@ const LeafEventer = {
|
|
|
5158
5161
|
this.on(type, listener, { once: true, capture });
|
|
5159
5162
|
},
|
|
5160
5163
|
emit(type, event, capture) {
|
|
5164
|
+
if (!event && EventCreator.has(type))
|
|
5165
|
+
event = EventCreator.get(type, { type, target: this, current: this });
|
|
5161
5166
|
const map = __getListenerMap(this, capture);
|
|
5162
5167
|
const list = map[type];
|
|
5163
5168
|
if (list) {
|
|
@@ -8272,14 +8277,19 @@ let Polygon = class Polygon extends UI {
|
|
|
8272
8277
|
__updateRenderPath() {
|
|
8273
8278
|
if (this.__.points && this.__.curve) {
|
|
8274
8279
|
drawPoints$1(this.__.__pathForRender = [], this.__.points, this.__.curve, true);
|
|
8275
|
-
this.__updateNaturalSize();
|
|
8276
8280
|
}
|
|
8277
8281
|
else {
|
|
8278
8282
|
super.__updateRenderPath();
|
|
8279
8283
|
}
|
|
8280
8284
|
}
|
|
8281
8285
|
__updateBoxBounds() {
|
|
8282
|
-
|
|
8286
|
+
if (this.__.points) {
|
|
8287
|
+
toBounds$2(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8288
|
+
this.__updateNaturalSize();
|
|
8289
|
+
}
|
|
8290
|
+
else {
|
|
8291
|
+
super.__updateBoxBounds();
|
|
8292
|
+
}
|
|
8283
8293
|
}
|
|
8284
8294
|
};
|
|
8285
8295
|
__decorate([
|
|
@@ -8373,7 +8383,7 @@ let Line = class Line extends UI {
|
|
|
8373
8383
|
}
|
|
8374
8384
|
__updateBoxBounds() {
|
|
8375
8385
|
if (this.points) {
|
|
8376
|
-
toBounds$1(this.__.
|
|
8386
|
+
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8377
8387
|
this.__updateNaturalSize();
|
|
8378
8388
|
}
|
|
8379
8389
|
else {
|
|
@@ -9999,7 +10009,7 @@ function getTextCase(char, textCase, firstChar) {
|
|
|
9999
10009
|
const { trimRight } = TextRowHelper;
|
|
10000
10010
|
const { Letter, Single, Before, After, Symbol, Break } = CharType;
|
|
10001
10011
|
let word, row, wordWidth, rowWidth, realWidth;
|
|
10002
|
-
let char, charWidth, charType, lastCharType, langBreak, afterBreak, paraStart;
|
|
10012
|
+
let char, charWidth, startCharSize, charSize, charType, lastCharType, langBreak, afterBreak, paraStart;
|
|
10003
10013
|
let textDrawData, rows = [], bounds;
|
|
10004
10014
|
function createRows(drawData, content, style) {
|
|
10005
10015
|
textDrawData = drawData;
|
|
@@ -10012,7 +10022,7 @@ function createRows(drawData, content, style) {
|
|
|
10012
10022
|
if (charMode) {
|
|
10013
10023
|
paraStart = true;
|
|
10014
10024
|
lastCharType = null;
|
|
10015
|
-
wordWidth = rowWidth = 0;
|
|
10025
|
+
startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
|
|
10016
10026
|
word = { data: [] }, row = { words: [] };
|
|
10017
10027
|
for (let i = 0, len = content.length; i < len; i++) {
|
|
10018
10028
|
char = content[i];
|
|
@@ -10028,8 +10038,11 @@ function createRows(drawData, content, style) {
|
|
|
10028
10038
|
if (charType === Letter && textCase !== 'none')
|
|
10029
10039
|
char = getTextCase(char, textCase, !wordWidth);
|
|
10030
10040
|
charWidth = canvas.measureText(char).width;
|
|
10031
|
-
if (__letterSpacing)
|
|
10041
|
+
if (__letterSpacing) {
|
|
10042
|
+
if (__letterSpacing < 0)
|
|
10043
|
+
charSize = charWidth;
|
|
10032
10044
|
charWidth += __letterSpacing;
|
|
10045
|
+
}
|
|
10033
10046
|
langBreak = (charType === Single && (lastCharType === Single || lastCharType === Letter)) || (lastCharType === Single && charType !== After);
|
|
10034
10047
|
afterBreak = ((charType === Before || charType === Single) && (lastCharType === Symbol || lastCharType === After));
|
|
10035
10048
|
realWidth = paraStart && paraIndent ? width - paraIndent : width;
|
|
@@ -10079,6 +10092,8 @@ function createRows(drawData, content, style) {
|
|
|
10079
10092
|
}
|
|
10080
10093
|
}
|
|
10081
10094
|
function addChar(char, width) {
|
|
10095
|
+
if (charSize && !startCharSize)
|
|
10096
|
+
startCharSize = charSize;
|
|
10082
10097
|
word.data.push({ char, width });
|
|
10083
10098
|
wordWidth += width;
|
|
10084
10099
|
}
|
|
@@ -10095,6 +10110,11 @@ function addRow() {
|
|
|
10095
10110
|
row.paraStart = true;
|
|
10096
10111
|
paraStart = false;
|
|
10097
10112
|
}
|
|
10113
|
+
if (charSize) {
|
|
10114
|
+
row.startCharSize = startCharSize;
|
|
10115
|
+
row.endCharSize = charSize;
|
|
10116
|
+
startCharSize = 0;
|
|
10117
|
+
}
|
|
10098
10118
|
row.width = rowWidth;
|
|
10099
10119
|
if (bounds.width)
|
|
10100
10120
|
trimRight(row);
|
|
@@ -10168,7 +10188,7 @@ function toChar(data, charX, rowData) {
|
|
|
10168
10188
|
|
|
10169
10189
|
function layoutText(drawData, style) {
|
|
10170
10190
|
const { rows, bounds } = drawData;
|
|
10171
|
-
const { __lineHeight, __baseLine, textAlign, verticalAlign, paraSpacing, textOverflow } = style;
|
|
10191
|
+
const { __lineHeight, __baseLine, __letterSpacing, textAlign, verticalAlign, paraSpacing, textOverflow } = style;
|
|
10172
10192
|
let { x, y, width, height } = bounds, realHeight = __lineHeight * rows.length + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
10173
10193
|
let starY = __baseLine;
|
|
10174
10194
|
if (textOverflow !== 'show' && realHeight > height) {
|
|
@@ -10185,7 +10205,7 @@ function layoutText(drawData, style) {
|
|
|
10185
10205
|
}
|
|
10186
10206
|
}
|
|
10187
10207
|
starY += y;
|
|
10188
|
-
let row;
|
|
10208
|
+
let row, rowX, rowWidth;
|
|
10189
10209
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10190
10210
|
row = rows[i];
|
|
10191
10211
|
row.x = x;
|
|
@@ -10204,20 +10224,22 @@ function layoutText(drawData, style) {
|
|
|
10204
10224
|
row.isOverflow = true;
|
|
10205
10225
|
drawData.overflow = i + 1;
|
|
10206
10226
|
}
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
if (
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
if (row.width > bounds.width)
|
|
10219
|
-
bounds.width = row.width;
|
|
10227
|
+
rowX = row.x;
|
|
10228
|
+
rowWidth = row.width;
|
|
10229
|
+
if (__letterSpacing < 0) {
|
|
10230
|
+
if (row.width < 0) {
|
|
10231
|
+
rowWidth = -row.width + style.fontSize + __letterSpacing;
|
|
10232
|
+
rowX -= rowWidth;
|
|
10233
|
+
rowWidth += style.fontSize;
|
|
10234
|
+
}
|
|
10235
|
+
else {
|
|
10236
|
+
rowWidth -= __letterSpacing;
|
|
10237
|
+
}
|
|
10220
10238
|
}
|
|
10239
|
+
if (rowX < bounds.x)
|
|
10240
|
+
bounds.x = rowX;
|
|
10241
|
+
if (rowWidth > bounds.width)
|
|
10242
|
+
bounds.width = rowWidth;
|
|
10221
10243
|
}
|
|
10222
10244
|
bounds.y = y;
|
|
10223
10245
|
bounds.height = realHeight;
|
|
@@ -10269,10 +10291,9 @@ const TextConvert = {
|
|
|
10269
10291
|
if (typeof content !== 'string')
|
|
10270
10292
|
content = String(content);
|
|
10271
10293
|
let x = 0, y = 0;
|
|
10272
|
-
let
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
width = 0;
|
|
10294
|
+
let width = style.__getInput('width') || 0;
|
|
10295
|
+
let height = style.__getInput('height') || 0;
|
|
10296
|
+
const { textDecoration, textOverflow, __font, padding } = style;
|
|
10276
10297
|
if (padding) {
|
|
10277
10298
|
const [top, right, bottom, left] = MathHelper.fourNumber(padding);
|
|
10278
10299
|
if (width) {
|