@antv/g-lite 1.0.4 → 1.0.6
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/dist/css/StyleValueRegistry.d.ts.map +1 -1
- package/dist/display-objects/Text.d.ts +10 -2
- package/dist/display-objects/Text.d.ts.map +1 -1
- package/dist/dom/Document.d.ts +2 -0
- package/dist/dom/Document.d.ts.map +1 -1
- package/dist/index.esm.js +177 -29
- package/dist/index.js +177 -29
- package/dist/index.umd.js +177 -29
- package/dist/index.umd.min.js +2 -2
- package/dist/services/RenderingService.d.ts +4 -0
- package/dist/services/RenderingService.d.ts.map +1 -1
- package/dist/services/TextService.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -7720,7 +7720,9 @@ exports.TextService = /*#__PURE__*/function () {
|
|
|
7720
7720
|
}
|
|
7721
7721
|
|
|
7722
7722
|
var context = this.offscreenCanvas.getOrCreateContext(offscreenCanvas);
|
|
7723
|
-
context.font = font;
|
|
7723
|
+
context.font = font; // no overflowing by default
|
|
7724
|
+
|
|
7725
|
+
parsedStyle.isOverflowing = false;
|
|
7724
7726
|
var outputText = wordWrap ? this.wordWrap(text, parsedStyle, offscreenCanvas) : text;
|
|
7725
7727
|
var lines = outputText.split(/(?:\r\n|\r|\n)/);
|
|
7726
7728
|
var lineWidths = new Array(lines.length);
|
|
@@ -7777,14 +7779,25 @@ exports.TextService = /*#__PURE__*/function () {
|
|
|
7777
7779
|
};
|
|
7778
7780
|
};
|
|
7779
7781
|
|
|
7780
|
-
_proto.wordWrap = function wordWrap(text,
|
|
7782
|
+
_proto.wordWrap = function wordWrap(text, parsedStyle, offscreenCanvas) {
|
|
7781
7783
|
var _this2 = this;
|
|
7782
7784
|
|
|
7783
|
-
var
|
|
7784
|
-
wordWrapWidth =
|
|
7785
|
-
letterSpacing =
|
|
7785
|
+
var _parsedStyle$wordWrap = parsedStyle.wordWrapWidth,
|
|
7786
|
+
wordWrapWidth = _parsedStyle$wordWrap === void 0 ? 0 : _parsedStyle$wordWrap,
|
|
7787
|
+
letterSpacing = parsedStyle.letterSpacing,
|
|
7788
|
+
_parsedStyle$maxLines = parsedStyle.maxLines,
|
|
7789
|
+
maxLines = _parsedStyle$maxLines === void 0 ? Infinity : _parsedStyle$maxLines,
|
|
7790
|
+
textOverflow = parsedStyle.textOverflow;
|
|
7786
7791
|
var context = this.offscreenCanvas.getOrCreateContext(offscreenCanvas);
|
|
7787
7792
|
var maxWidth = wordWrapWidth + letterSpacing;
|
|
7793
|
+
var ellipsis = '';
|
|
7794
|
+
|
|
7795
|
+
if (textOverflow === 'ellipsis') {
|
|
7796
|
+
ellipsis = '...';
|
|
7797
|
+
} else if (textOverflow && textOverflow !== 'clip') {
|
|
7798
|
+
ellipsis = textOverflow;
|
|
7799
|
+
}
|
|
7800
|
+
|
|
7788
7801
|
var lines = [];
|
|
7789
7802
|
var currentIndex = 0;
|
|
7790
7803
|
var currentWidth = 0;
|
|
@@ -7794,41 +7807,74 @@ exports.TextService = /*#__PURE__*/function () {
|
|
|
7794
7807
|
return _this2.getFromCache(char, letterSpacing, cache, context);
|
|
7795
7808
|
};
|
|
7796
7809
|
|
|
7797
|
-
Array.from(
|
|
7810
|
+
var ellipsisWidth = Array.from(ellipsis).reduce(function (prev, cur) {
|
|
7811
|
+
return prev + calcWidth(cur);
|
|
7812
|
+
}, 0);
|
|
7813
|
+
var chars = Array.from(text);
|
|
7814
|
+
|
|
7815
|
+
for (var i = 0; i < chars.length; i++) {
|
|
7816
|
+
var char = chars[i];
|
|
7798
7817
|
var prevChar = text[i - 1];
|
|
7799
7818
|
var nextChar = text[i + 1];
|
|
7800
7819
|
var width = calcWidth(char);
|
|
7801
7820
|
|
|
7802
|
-
if (
|
|
7821
|
+
if (this.isNewline(char)) {
|
|
7803
7822
|
currentIndex++;
|
|
7804
7823
|
currentWidth = 0;
|
|
7805
7824
|
lines[currentIndex] = '';
|
|
7806
|
-
|
|
7825
|
+
continue;
|
|
7807
7826
|
}
|
|
7808
7827
|
|
|
7809
7828
|
if (currentWidth > 0 && currentWidth + width > maxWidth) {
|
|
7829
|
+
if (currentIndex + 1 >= maxLines) {
|
|
7830
|
+
parsedStyle.isOverflowing = true; // If there is not enough space to display the string itself, it is clipped.
|
|
7831
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
|
|
7832
|
+
|
|
7833
|
+
if (ellipsisWidth > 0 && ellipsisWidth <= maxWidth) {
|
|
7834
|
+
// Backspace from line's end.
|
|
7835
|
+
var lastLineWidth = 0;
|
|
7836
|
+
var lastLineIndex = 0;
|
|
7837
|
+
|
|
7838
|
+
for (var _i = 0; _i < lines[currentIndex].length; _i++) {
|
|
7839
|
+
var _width = calcWidth(lines[currentIndex][_i]);
|
|
7840
|
+
|
|
7841
|
+
if (lastLineWidth + _width + ellipsisWidth > maxWidth) {
|
|
7842
|
+
lastLineIndex = _i;
|
|
7843
|
+
break;
|
|
7844
|
+
}
|
|
7845
|
+
|
|
7846
|
+
lastLineWidth += _width;
|
|
7847
|
+
}
|
|
7848
|
+
|
|
7849
|
+
lines[currentIndex] = (lines[currentIndex] || '').slice(0, lastLineIndex) + ellipsis;
|
|
7850
|
+
}
|
|
7851
|
+
|
|
7852
|
+
break;
|
|
7853
|
+
}
|
|
7854
|
+
|
|
7810
7855
|
currentIndex++;
|
|
7811
7856
|
currentWidth = 0;
|
|
7812
7857
|
lines[currentIndex] = '';
|
|
7813
7858
|
|
|
7814
|
-
if (
|
|
7815
|
-
|
|
7859
|
+
if (this.isBreakingSpace(char)) {
|
|
7860
|
+
continue;
|
|
7816
7861
|
}
|
|
7817
7862
|
|
|
7818
|
-
if (!
|
|
7819
|
-
lines =
|
|
7820
|
-
currentWidth =
|
|
7863
|
+
if (!this.canBreakInLastChar(char)) {
|
|
7864
|
+
lines = this.trimToBreakable(lines);
|
|
7865
|
+
currentWidth = this.sumTextWidthByCache(lines[currentIndex] || '', cache);
|
|
7821
7866
|
}
|
|
7822
7867
|
|
|
7823
|
-
if (
|
|
7824
|
-
lines =
|
|
7868
|
+
if (this.shouldBreakByKinsokuShorui(char, nextChar)) {
|
|
7869
|
+
lines = this.trimByKinsokuShorui(lines);
|
|
7825
7870
|
currentWidth += calcWidth(prevChar || '');
|
|
7826
7871
|
}
|
|
7827
7872
|
}
|
|
7828
7873
|
|
|
7829
7874
|
currentWidth += width;
|
|
7830
7875
|
lines[currentIndex] = (lines[currentIndex] || '') + char;
|
|
7831
|
-
}
|
|
7876
|
+
}
|
|
7877
|
+
|
|
7832
7878
|
return lines.join('\n');
|
|
7833
7879
|
};
|
|
7834
7880
|
|
|
@@ -8882,6 +8928,47 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
8882
8928
|
return b.sortable.renderOrder - a.sortable.renderOrder;
|
|
8883
8929
|
});
|
|
8884
8930
|
return hitTestList;
|
|
8931
|
+
};
|
|
8932
|
+
|
|
8933
|
+
_proto.elementFromPointSync = function elementFromPointSync(x, y) {
|
|
8934
|
+
var _this$defaultView$can = this.defaultView.canvas2Viewport({
|
|
8935
|
+
x: x,
|
|
8936
|
+
y: y
|
|
8937
|
+
}),
|
|
8938
|
+
viewportX = _this$defaultView$can.x,
|
|
8939
|
+
viewportY = _this$defaultView$can.y;
|
|
8940
|
+
|
|
8941
|
+
var _this$defaultView$get = this.defaultView.getConfig(),
|
|
8942
|
+
width = _this$defaultView$get.width,
|
|
8943
|
+
height = _this$defaultView$get.height; // outside canvas' viewport
|
|
8944
|
+
|
|
8945
|
+
|
|
8946
|
+
if (viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height) {
|
|
8947
|
+
return null;
|
|
8948
|
+
}
|
|
8949
|
+
|
|
8950
|
+
var _this$defaultView$vie = this.defaultView.viewport2Client({
|
|
8951
|
+
x: viewportX,
|
|
8952
|
+
y: viewportY
|
|
8953
|
+
}),
|
|
8954
|
+
clientX = _this$defaultView$vie.x,
|
|
8955
|
+
clientY = _this$defaultView$vie.y;
|
|
8956
|
+
|
|
8957
|
+
var _this$defaultView$get2 = this.defaultView.getRenderingService().hooks.pickSync.call({
|
|
8958
|
+
topmost: true,
|
|
8959
|
+
position: {
|
|
8960
|
+
x: x,
|
|
8961
|
+
y: y,
|
|
8962
|
+
viewportX: viewportX,
|
|
8963
|
+
viewportY: viewportY,
|
|
8964
|
+
clientX: clientX,
|
|
8965
|
+
clientY: clientY
|
|
8966
|
+
},
|
|
8967
|
+
picked: []
|
|
8968
|
+
}),
|
|
8969
|
+
picked = _this$defaultView$get2.picked;
|
|
8970
|
+
|
|
8971
|
+
return picked && picked[0] || this.documentElement;
|
|
8885
8972
|
}
|
|
8886
8973
|
/**
|
|
8887
8974
|
* Do picking with API instead of triggering interactive events.
|
|
@@ -8894,17 +8981,17 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
8894
8981
|
/*#__PURE__*/
|
|
8895
8982
|
function () {
|
|
8896
8983
|
var _elementFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(x, y) {
|
|
8897
|
-
var _this$defaultView$
|
|
8984
|
+
var _this$defaultView$can2, viewportX, viewportY, _this$defaultView$get3, width, height, _this$defaultView$vie2, clientX, clientY, _yield$this$defaultVi, picked;
|
|
8898
8985
|
|
|
8899
8986
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8900
8987
|
while (1) {
|
|
8901
8988
|
switch (_context.prev = _context.next) {
|
|
8902
8989
|
case 0:
|
|
8903
|
-
_this$defaultView$
|
|
8990
|
+
_this$defaultView$can2 = this.defaultView.canvas2Viewport({
|
|
8904
8991
|
x: x,
|
|
8905
8992
|
y: y
|
|
8906
|
-
}), viewportX = _this$defaultView$
|
|
8907
|
-
_this$defaultView$
|
|
8993
|
+
}), viewportX = _this$defaultView$can2.x, viewportY = _this$defaultView$can2.y;
|
|
8994
|
+
_this$defaultView$get3 = this.defaultView.getConfig(), width = _this$defaultView$get3.width, height = _this$defaultView$get3.height; // outside canvas' viewport
|
|
8908
8995
|
|
|
8909
8996
|
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
8910
8997
|
_context.next = 4;
|
|
@@ -8914,10 +9001,10 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
8914
9001
|
return _context.abrupt("return", null);
|
|
8915
9002
|
|
|
8916
9003
|
case 4:
|
|
8917
|
-
_this$defaultView$
|
|
9004
|
+
_this$defaultView$vie2 = this.defaultView.viewport2Client({
|
|
8918
9005
|
x: viewportX,
|
|
8919
9006
|
y: viewportY
|
|
8920
|
-
}), clientX = _this$defaultView$
|
|
9007
|
+
}), clientX = _this$defaultView$vie2.x, clientY = _this$defaultView$vie2.y;
|
|
8921
9008
|
_context.next = 7;
|
|
8922
9009
|
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
8923
9010
|
topmost: true,
|
|
@@ -8950,7 +9037,52 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
8950
9037
|
}
|
|
8951
9038
|
|
|
8952
9039
|
return elementFromPoint;
|
|
8953
|
-
}()
|
|
9040
|
+
}();
|
|
9041
|
+
|
|
9042
|
+
_proto.elementsFromPointSync = function elementsFromPointSync(x, y) {
|
|
9043
|
+
var _this$defaultView$can3 = this.defaultView.canvas2Viewport({
|
|
9044
|
+
x: x,
|
|
9045
|
+
y: y
|
|
9046
|
+
}),
|
|
9047
|
+
viewportX = _this$defaultView$can3.x,
|
|
9048
|
+
viewportY = _this$defaultView$can3.y;
|
|
9049
|
+
|
|
9050
|
+
var _this$defaultView$get4 = this.defaultView.getConfig(),
|
|
9051
|
+
width = _this$defaultView$get4.width,
|
|
9052
|
+
height = _this$defaultView$get4.height; // outside canvas' viewport
|
|
9053
|
+
|
|
9054
|
+
|
|
9055
|
+
if (viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height) {
|
|
9056
|
+
return [];
|
|
9057
|
+
}
|
|
9058
|
+
|
|
9059
|
+
var _this$defaultView$vie3 = this.defaultView.viewport2Client({
|
|
9060
|
+
x: viewportX,
|
|
9061
|
+
y: viewportY
|
|
9062
|
+
}),
|
|
9063
|
+
clientX = _this$defaultView$vie3.x,
|
|
9064
|
+
clientY = _this$defaultView$vie3.y;
|
|
9065
|
+
|
|
9066
|
+
var _this$defaultView$get5 = this.defaultView.getRenderingService().hooks.pickSync.call({
|
|
9067
|
+
topmost: false,
|
|
9068
|
+
position: {
|
|
9069
|
+
x: x,
|
|
9070
|
+
y: y,
|
|
9071
|
+
viewportX: viewportX,
|
|
9072
|
+
viewportY: viewportY,
|
|
9073
|
+
clientX: clientX,
|
|
9074
|
+
clientY: clientY
|
|
9075
|
+
},
|
|
9076
|
+
picked: []
|
|
9077
|
+
}),
|
|
9078
|
+
picked = _this$defaultView$get5.picked;
|
|
9079
|
+
|
|
9080
|
+
if (picked[picked.length - 1] !== this.documentElement) {
|
|
9081
|
+
picked.push(this.documentElement);
|
|
9082
|
+
}
|
|
9083
|
+
|
|
9084
|
+
return picked;
|
|
9085
|
+
}
|
|
8954
9086
|
/**
|
|
8955
9087
|
* Do picking with API instead of triggering interactive events.
|
|
8956
9088
|
*
|
|
@@ -8962,17 +9094,17 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
8962
9094
|
/*#__PURE__*/
|
|
8963
9095
|
function () {
|
|
8964
9096
|
var _elementsFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x, y) {
|
|
8965
|
-
var _this$defaultView$
|
|
9097
|
+
var _this$defaultView$can4, viewportX, viewportY, _this$defaultView$get6, width, height, _this$defaultView$vie4, clientX, clientY, _yield$this$defaultVi2, picked;
|
|
8966
9098
|
|
|
8967
9099
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8968
9100
|
while (1) {
|
|
8969
9101
|
switch (_context2.prev = _context2.next) {
|
|
8970
9102
|
case 0:
|
|
8971
|
-
_this$defaultView$
|
|
9103
|
+
_this$defaultView$can4 = this.defaultView.canvas2Viewport({
|
|
8972
9104
|
x: x,
|
|
8973
9105
|
y: y
|
|
8974
|
-
}), viewportX = _this$defaultView$
|
|
8975
|
-
_this$defaultView$
|
|
9106
|
+
}), viewportX = _this$defaultView$can4.x, viewportY = _this$defaultView$can4.y;
|
|
9107
|
+
_this$defaultView$get6 = this.defaultView.getConfig(), width = _this$defaultView$get6.width, height = _this$defaultView$get6.height; // outside canvas' viewport
|
|
8976
9108
|
|
|
8977
9109
|
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
8978
9110
|
_context2.next = 4;
|
|
@@ -8982,10 +9114,10 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
8982
9114
|
return _context2.abrupt("return", []);
|
|
8983
9115
|
|
|
8984
9116
|
case 4:
|
|
8985
|
-
_this$defaultView$
|
|
9117
|
+
_this$defaultView$vie4 = this.defaultView.viewport2Client({
|
|
8986
9118
|
x: viewportX,
|
|
8987
9119
|
y: viewportY
|
|
8988
|
-
}), clientX = _this$defaultView$
|
|
9120
|
+
}), clientX = _this$defaultView$vie4.x, clientY = _this$defaultView$vie4.y;
|
|
8989
9121
|
_context2.next = 7;
|
|
8990
9122
|
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
8991
9123
|
topmost: false,
|
|
@@ -11981,6 +12113,10 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
11981
12113
|
return ((_this$parsedStyle$met2 = this.parsedStyle.metrics) === null || _this$parsedStyle$met2 === void 0 ? void 0 : _this$parsedStyle$met2.lineMetrics) || [];
|
|
11982
12114
|
};
|
|
11983
12115
|
|
|
12116
|
+
_proto.isOverflowing = function isOverflowing() {
|
|
12117
|
+
return !!this.parsedStyle.isOverflowing;
|
|
12118
|
+
};
|
|
12119
|
+
|
|
11984
12120
|
return Text;
|
|
11985
12121
|
}(DisplayObject);
|
|
11986
12122
|
|
|
@@ -14086,6 +14222,11 @@ exports.RenderingService = /*#__PURE__*/function () {
|
|
|
14086
14222
|
*/
|
|
14087
14223
|
pick: new AsyncSeriesWaterfallHook(['result']),
|
|
14088
14224
|
|
|
14225
|
+
/**
|
|
14226
|
+
* Unsafe but sync version of pick.
|
|
14227
|
+
*/
|
|
14228
|
+
pickSync: new SyncWaterfallHook(['result']),
|
|
14229
|
+
|
|
14089
14230
|
/**
|
|
14090
14231
|
* used in event system
|
|
14091
14232
|
*/
|
|
@@ -16669,6 +16810,13 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
16669
16810
|
}, {
|
|
16670
16811
|
n: 'wordWrapWidth',
|
|
16671
16812
|
l: true
|
|
16813
|
+
}, {
|
|
16814
|
+
n: 'maxLines',
|
|
16815
|
+
l: true
|
|
16816
|
+
}, {
|
|
16817
|
+
n: 'textOverflow',
|
|
16818
|
+
l: true,
|
|
16819
|
+
d: 'clip'
|
|
16672
16820
|
}, {
|
|
16673
16821
|
n: 'leading',
|
|
16674
16822
|
l: true
|
package/dist/index.umd.js
CHANGED
|
@@ -17960,7 +17960,9 @@
|
|
|
17960
17960
|
}
|
|
17961
17961
|
|
|
17962
17962
|
var context = this.offscreenCanvas.getOrCreateContext(offscreenCanvas);
|
|
17963
|
-
context.font = font;
|
|
17963
|
+
context.font = font; // no overflowing by default
|
|
17964
|
+
|
|
17965
|
+
parsedStyle.isOverflowing = false;
|
|
17964
17966
|
var outputText = wordWrap ? this.wordWrap(text, parsedStyle, offscreenCanvas) : text;
|
|
17965
17967
|
var lines = outputText.split(/(?:\r\n|\r|\n)/);
|
|
17966
17968
|
var lineWidths = new Array(lines.length);
|
|
@@ -18017,14 +18019,25 @@
|
|
|
18017
18019
|
};
|
|
18018
18020
|
};
|
|
18019
18021
|
|
|
18020
|
-
_proto.wordWrap = function wordWrap(text,
|
|
18022
|
+
_proto.wordWrap = function wordWrap(text, parsedStyle, offscreenCanvas) {
|
|
18021
18023
|
var _this2 = this;
|
|
18022
18024
|
|
|
18023
|
-
var
|
|
18024
|
-
wordWrapWidth =
|
|
18025
|
-
letterSpacing =
|
|
18025
|
+
var _parsedStyle$wordWrap = parsedStyle.wordWrapWidth,
|
|
18026
|
+
wordWrapWidth = _parsedStyle$wordWrap === void 0 ? 0 : _parsedStyle$wordWrap,
|
|
18027
|
+
letterSpacing = parsedStyle.letterSpacing,
|
|
18028
|
+
_parsedStyle$maxLines = parsedStyle.maxLines,
|
|
18029
|
+
maxLines = _parsedStyle$maxLines === void 0 ? Infinity : _parsedStyle$maxLines,
|
|
18030
|
+
textOverflow = parsedStyle.textOverflow;
|
|
18026
18031
|
var context = this.offscreenCanvas.getOrCreateContext(offscreenCanvas);
|
|
18027
18032
|
var maxWidth = wordWrapWidth + letterSpacing;
|
|
18033
|
+
var ellipsis = '';
|
|
18034
|
+
|
|
18035
|
+
if (textOverflow === 'ellipsis') {
|
|
18036
|
+
ellipsis = '...';
|
|
18037
|
+
} else if (textOverflow && textOverflow !== 'clip') {
|
|
18038
|
+
ellipsis = textOverflow;
|
|
18039
|
+
}
|
|
18040
|
+
|
|
18028
18041
|
var lines = [];
|
|
18029
18042
|
var currentIndex = 0;
|
|
18030
18043
|
var currentWidth = 0;
|
|
@@ -18034,41 +18047,74 @@
|
|
|
18034
18047
|
return _this2.getFromCache(char, letterSpacing, cache, context);
|
|
18035
18048
|
};
|
|
18036
18049
|
|
|
18037
|
-
Array.from(
|
|
18050
|
+
var ellipsisWidth = Array.from(ellipsis).reduce(function (prev, cur) {
|
|
18051
|
+
return prev + calcWidth(cur);
|
|
18052
|
+
}, 0);
|
|
18053
|
+
var chars = Array.from(text);
|
|
18054
|
+
|
|
18055
|
+
for (var i = 0; i < chars.length; i++) {
|
|
18056
|
+
var char = chars[i];
|
|
18038
18057
|
var prevChar = text[i - 1];
|
|
18039
18058
|
var nextChar = text[i + 1];
|
|
18040
18059
|
var width = calcWidth(char);
|
|
18041
18060
|
|
|
18042
|
-
if (
|
|
18061
|
+
if (this.isNewline(char)) {
|
|
18043
18062
|
currentIndex++;
|
|
18044
18063
|
currentWidth = 0;
|
|
18045
18064
|
lines[currentIndex] = '';
|
|
18046
|
-
|
|
18065
|
+
continue;
|
|
18047
18066
|
}
|
|
18048
18067
|
|
|
18049
18068
|
if (currentWidth > 0 && currentWidth + width > maxWidth) {
|
|
18069
|
+
if (currentIndex + 1 >= maxLines) {
|
|
18070
|
+
parsedStyle.isOverflowing = true; // If there is not enough space to display the string itself, it is clipped.
|
|
18071
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
|
|
18072
|
+
|
|
18073
|
+
if (ellipsisWidth > 0 && ellipsisWidth <= maxWidth) {
|
|
18074
|
+
// Backspace from line's end.
|
|
18075
|
+
var lastLineWidth = 0;
|
|
18076
|
+
var lastLineIndex = 0;
|
|
18077
|
+
|
|
18078
|
+
for (var _i = 0; _i < lines[currentIndex].length; _i++) {
|
|
18079
|
+
var _width = calcWidth(lines[currentIndex][_i]);
|
|
18080
|
+
|
|
18081
|
+
if (lastLineWidth + _width + ellipsisWidth > maxWidth) {
|
|
18082
|
+
lastLineIndex = _i;
|
|
18083
|
+
break;
|
|
18084
|
+
}
|
|
18085
|
+
|
|
18086
|
+
lastLineWidth += _width;
|
|
18087
|
+
}
|
|
18088
|
+
|
|
18089
|
+
lines[currentIndex] = (lines[currentIndex] || '').slice(0, lastLineIndex) + ellipsis;
|
|
18090
|
+
}
|
|
18091
|
+
|
|
18092
|
+
break;
|
|
18093
|
+
}
|
|
18094
|
+
|
|
18050
18095
|
currentIndex++;
|
|
18051
18096
|
currentWidth = 0;
|
|
18052
18097
|
lines[currentIndex] = '';
|
|
18053
18098
|
|
|
18054
|
-
if (
|
|
18055
|
-
|
|
18099
|
+
if (this.isBreakingSpace(char)) {
|
|
18100
|
+
continue;
|
|
18056
18101
|
}
|
|
18057
18102
|
|
|
18058
|
-
if (!
|
|
18059
|
-
lines =
|
|
18060
|
-
currentWidth =
|
|
18103
|
+
if (!this.canBreakInLastChar(char)) {
|
|
18104
|
+
lines = this.trimToBreakable(lines);
|
|
18105
|
+
currentWidth = this.sumTextWidthByCache(lines[currentIndex] || '', cache);
|
|
18061
18106
|
}
|
|
18062
18107
|
|
|
18063
|
-
if (
|
|
18064
|
-
lines =
|
|
18108
|
+
if (this.shouldBreakByKinsokuShorui(char, nextChar)) {
|
|
18109
|
+
lines = this.trimByKinsokuShorui(lines);
|
|
18065
18110
|
currentWidth += calcWidth(prevChar || '');
|
|
18066
18111
|
}
|
|
18067
18112
|
}
|
|
18068
18113
|
|
|
18069
18114
|
currentWidth += width;
|
|
18070
18115
|
lines[currentIndex] = (lines[currentIndex] || '') + char;
|
|
18071
|
-
}
|
|
18116
|
+
}
|
|
18117
|
+
|
|
18072
18118
|
return lines.join('\n');
|
|
18073
18119
|
};
|
|
18074
18120
|
|
|
@@ -19460,6 +19506,47 @@
|
|
|
19460
19506
|
return b.sortable.renderOrder - a.sortable.renderOrder;
|
|
19461
19507
|
});
|
|
19462
19508
|
return hitTestList;
|
|
19509
|
+
};
|
|
19510
|
+
|
|
19511
|
+
_proto.elementFromPointSync = function elementFromPointSync(x, y) {
|
|
19512
|
+
var _this$defaultView$can = this.defaultView.canvas2Viewport({
|
|
19513
|
+
x: x,
|
|
19514
|
+
y: y
|
|
19515
|
+
}),
|
|
19516
|
+
viewportX = _this$defaultView$can.x,
|
|
19517
|
+
viewportY = _this$defaultView$can.y;
|
|
19518
|
+
|
|
19519
|
+
var _this$defaultView$get = this.defaultView.getConfig(),
|
|
19520
|
+
width = _this$defaultView$get.width,
|
|
19521
|
+
height = _this$defaultView$get.height; // outside canvas' viewport
|
|
19522
|
+
|
|
19523
|
+
|
|
19524
|
+
if (viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height) {
|
|
19525
|
+
return null;
|
|
19526
|
+
}
|
|
19527
|
+
|
|
19528
|
+
var _this$defaultView$vie = this.defaultView.viewport2Client({
|
|
19529
|
+
x: viewportX,
|
|
19530
|
+
y: viewportY
|
|
19531
|
+
}),
|
|
19532
|
+
clientX = _this$defaultView$vie.x,
|
|
19533
|
+
clientY = _this$defaultView$vie.y;
|
|
19534
|
+
|
|
19535
|
+
var _this$defaultView$get2 = this.defaultView.getRenderingService().hooks.pickSync.call({
|
|
19536
|
+
topmost: true,
|
|
19537
|
+
position: {
|
|
19538
|
+
x: x,
|
|
19539
|
+
y: y,
|
|
19540
|
+
viewportX: viewportX,
|
|
19541
|
+
viewportY: viewportY,
|
|
19542
|
+
clientX: clientX,
|
|
19543
|
+
clientY: clientY
|
|
19544
|
+
},
|
|
19545
|
+
picked: []
|
|
19546
|
+
}),
|
|
19547
|
+
picked = _this$defaultView$get2.picked;
|
|
19548
|
+
|
|
19549
|
+
return picked && picked[0] || this.documentElement;
|
|
19463
19550
|
}
|
|
19464
19551
|
/**
|
|
19465
19552
|
* Do picking with API instead of triggering interactive events.
|
|
@@ -19472,17 +19559,17 @@
|
|
|
19472
19559
|
/*#__PURE__*/
|
|
19473
19560
|
function () {
|
|
19474
19561
|
var _elementFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(x, y) {
|
|
19475
|
-
var _this$defaultView$
|
|
19562
|
+
var _this$defaultView$can2, viewportX, viewportY, _this$defaultView$get3, width, height, _this$defaultView$vie2, clientX, clientY, _yield$this$defaultVi, picked;
|
|
19476
19563
|
|
|
19477
19564
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19478
19565
|
while (1) {
|
|
19479
19566
|
switch (_context.prev = _context.next) {
|
|
19480
19567
|
case 0:
|
|
19481
|
-
_this$defaultView$
|
|
19568
|
+
_this$defaultView$can2 = this.defaultView.canvas2Viewport({
|
|
19482
19569
|
x: x,
|
|
19483
19570
|
y: y
|
|
19484
|
-
}), viewportX = _this$defaultView$
|
|
19485
|
-
_this$defaultView$
|
|
19571
|
+
}), viewportX = _this$defaultView$can2.x, viewportY = _this$defaultView$can2.y;
|
|
19572
|
+
_this$defaultView$get3 = this.defaultView.getConfig(), width = _this$defaultView$get3.width, height = _this$defaultView$get3.height; // outside canvas' viewport
|
|
19486
19573
|
|
|
19487
19574
|
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
19488
19575
|
_context.next = 4;
|
|
@@ -19492,10 +19579,10 @@
|
|
|
19492
19579
|
return _context.abrupt("return", null);
|
|
19493
19580
|
|
|
19494
19581
|
case 4:
|
|
19495
|
-
_this$defaultView$
|
|
19582
|
+
_this$defaultView$vie2 = this.defaultView.viewport2Client({
|
|
19496
19583
|
x: viewportX,
|
|
19497
19584
|
y: viewportY
|
|
19498
|
-
}), clientX = _this$defaultView$
|
|
19585
|
+
}), clientX = _this$defaultView$vie2.x, clientY = _this$defaultView$vie2.y;
|
|
19499
19586
|
_context.next = 7;
|
|
19500
19587
|
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
19501
19588
|
topmost: true,
|
|
@@ -19528,7 +19615,52 @@
|
|
|
19528
19615
|
}
|
|
19529
19616
|
|
|
19530
19617
|
return elementFromPoint;
|
|
19531
|
-
}()
|
|
19618
|
+
}();
|
|
19619
|
+
|
|
19620
|
+
_proto.elementsFromPointSync = function elementsFromPointSync(x, y) {
|
|
19621
|
+
var _this$defaultView$can3 = this.defaultView.canvas2Viewport({
|
|
19622
|
+
x: x,
|
|
19623
|
+
y: y
|
|
19624
|
+
}),
|
|
19625
|
+
viewportX = _this$defaultView$can3.x,
|
|
19626
|
+
viewportY = _this$defaultView$can3.y;
|
|
19627
|
+
|
|
19628
|
+
var _this$defaultView$get4 = this.defaultView.getConfig(),
|
|
19629
|
+
width = _this$defaultView$get4.width,
|
|
19630
|
+
height = _this$defaultView$get4.height; // outside canvas' viewport
|
|
19631
|
+
|
|
19632
|
+
|
|
19633
|
+
if (viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height) {
|
|
19634
|
+
return [];
|
|
19635
|
+
}
|
|
19636
|
+
|
|
19637
|
+
var _this$defaultView$vie3 = this.defaultView.viewport2Client({
|
|
19638
|
+
x: viewportX,
|
|
19639
|
+
y: viewportY
|
|
19640
|
+
}),
|
|
19641
|
+
clientX = _this$defaultView$vie3.x,
|
|
19642
|
+
clientY = _this$defaultView$vie3.y;
|
|
19643
|
+
|
|
19644
|
+
var _this$defaultView$get5 = this.defaultView.getRenderingService().hooks.pickSync.call({
|
|
19645
|
+
topmost: false,
|
|
19646
|
+
position: {
|
|
19647
|
+
x: x,
|
|
19648
|
+
y: y,
|
|
19649
|
+
viewportX: viewportX,
|
|
19650
|
+
viewportY: viewportY,
|
|
19651
|
+
clientX: clientX,
|
|
19652
|
+
clientY: clientY
|
|
19653
|
+
},
|
|
19654
|
+
picked: []
|
|
19655
|
+
}),
|
|
19656
|
+
picked = _this$defaultView$get5.picked;
|
|
19657
|
+
|
|
19658
|
+
if (picked[picked.length - 1] !== this.documentElement) {
|
|
19659
|
+
picked.push(this.documentElement);
|
|
19660
|
+
}
|
|
19661
|
+
|
|
19662
|
+
return picked;
|
|
19663
|
+
}
|
|
19532
19664
|
/**
|
|
19533
19665
|
* Do picking with API instead of triggering interactive events.
|
|
19534
19666
|
*
|
|
@@ -19540,17 +19672,17 @@
|
|
|
19540
19672
|
/*#__PURE__*/
|
|
19541
19673
|
function () {
|
|
19542
19674
|
var _elementsFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x, y) {
|
|
19543
|
-
var _this$defaultView$
|
|
19675
|
+
var _this$defaultView$can4, viewportX, viewportY, _this$defaultView$get6, width, height, _this$defaultView$vie4, clientX, clientY, _yield$this$defaultVi2, picked;
|
|
19544
19676
|
|
|
19545
19677
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
19546
19678
|
while (1) {
|
|
19547
19679
|
switch (_context2.prev = _context2.next) {
|
|
19548
19680
|
case 0:
|
|
19549
|
-
_this$defaultView$
|
|
19681
|
+
_this$defaultView$can4 = this.defaultView.canvas2Viewport({
|
|
19550
19682
|
x: x,
|
|
19551
19683
|
y: y
|
|
19552
|
-
}), viewportX = _this$defaultView$
|
|
19553
|
-
_this$defaultView$
|
|
19684
|
+
}), viewportX = _this$defaultView$can4.x, viewportY = _this$defaultView$can4.y;
|
|
19685
|
+
_this$defaultView$get6 = this.defaultView.getConfig(), width = _this$defaultView$get6.width, height = _this$defaultView$get6.height; // outside canvas' viewport
|
|
19554
19686
|
|
|
19555
19687
|
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
19556
19688
|
_context2.next = 4;
|
|
@@ -19560,10 +19692,10 @@
|
|
|
19560
19692
|
return _context2.abrupt("return", []);
|
|
19561
19693
|
|
|
19562
19694
|
case 4:
|
|
19563
|
-
_this$defaultView$
|
|
19695
|
+
_this$defaultView$vie4 = this.defaultView.viewport2Client({
|
|
19564
19696
|
x: viewportX,
|
|
19565
19697
|
y: viewportY
|
|
19566
|
-
}), clientX = _this$defaultView$
|
|
19698
|
+
}), clientX = _this$defaultView$vie4.x, clientY = _this$defaultView$vie4.y;
|
|
19567
19699
|
_context2.next = 7;
|
|
19568
19700
|
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
19569
19701
|
topmost: false,
|
|
@@ -22559,6 +22691,10 @@
|
|
|
22559
22691
|
return ((_this$parsedStyle$met2 = this.parsedStyle.metrics) === null || _this$parsedStyle$met2 === void 0 ? void 0 : _this$parsedStyle$met2.lineMetrics) || [];
|
|
22560
22692
|
};
|
|
22561
22693
|
|
|
22694
|
+
_proto.isOverflowing = function isOverflowing() {
|
|
22695
|
+
return !!this.parsedStyle.isOverflowing;
|
|
22696
|
+
};
|
|
22697
|
+
|
|
22562
22698
|
return Text;
|
|
22563
22699
|
}(DisplayObject);
|
|
22564
22700
|
|
|
@@ -24664,6 +24800,11 @@
|
|
|
24664
24800
|
*/
|
|
24665
24801
|
pick: new AsyncSeriesWaterfallHook(['result']),
|
|
24666
24802
|
|
|
24803
|
+
/**
|
|
24804
|
+
* Unsafe but sync version of pick.
|
|
24805
|
+
*/
|
|
24806
|
+
pickSync: new SyncWaterfallHook(['result']),
|
|
24807
|
+
|
|
24667
24808
|
/**
|
|
24668
24809
|
* used in event system
|
|
24669
24810
|
*/
|
|
@@ -27247,6 +27388,13 @@
|
|
|
27247
27388
|
}, {
|
|
27248
27389
|
n: 'wordWrapWidth',
|
|
27249
27390
|
l: true
|
|
27391
|
+
}, {
|
|
27392
|
+
n: 'maxLines',
|
|
27393
|
+
l: true
|
|
27394
|
+
}, {
|
|
27395
|
+
n: 'textOverflow',
|
|
27396
|
+
l: true,
|
|
27397
|
+
d: 'clip'
|
|
27250
27398
|
}, {
|
|
27251
27399
|
n: 'leading',
|
|
27252
27400
|
l: true
|