leafer-draw 1.4.2 → 1.5.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/dist/web.cjs +8 -7
- package/dist/web.cjs.map +1 -1
- package/dist/web.esm.js +8 -7
- package/dist/web.esm.js.map +1 -1
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +29 -25
- package/dist/web.js.map +1 -1
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +29 -25
- package/dist/web.module.js.map +1 -1
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +2 -2
package/dist/web.esm.js
CHANGED
|
@@ -124,7 +124,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
124
124
|
else {
|
|
125
125
|
window.addEventListener('resize', this.windowListener = () => {
|
|
126
126
|
const pixelRatio = Platform.devicePixelRatio;
|
|
127
|
-
if (this.pixelRatio !== pixelRatio) {
|
|
127
|
+
if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
|
|
128
128
|
const { width, height } = this;
|
|
129
129
|
this.emitResize({ width, height, pixelRatio });
|
|
130
130
|
}
|
|
@@ -141,7 +141,7 @@ class LeaferCanvas extends LeaferCanvasBase {
|
|
|
141
141
|
checkAutoBounds(parentSize) {
|
|
142
142
|
const view = this.view;
|
|
143
143
|
const { x, y, width, height } = this.autoBounds.getBoundsFrom(parentSize);
|
|
144
|
-
const size = { width, height, pixelRatio: Platform.devicePixelRatio };
|
|
144
|
+
const size = { width, height, pixelRatio: this.config.pixelRatio ? this.pixelRatio : Platform.devicePixelRatio };
|
|
145
145
|
if (!this.isSameSize(size)) {
|
|
146
146
|
const { style } = view;
|
|
147
147
|
style.marginLeft = x + 'px';
|
|
@@ -2167,13 +2167,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
2167
2167
|
}
|
|
2168
2168
|
|
|
2169
2169
|
function layoutText(drawData, style) {
|
|
2170
|
-
const { rows, bounds } = drawData;
|
|
2170
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
2171
2171
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
2172
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
2172
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
2173
2173
|
let starY = __baseLine;
|
|
2174
2174
|
if (__clipText && realHeight > height) {
|
|
2175
2175
|
realHeight = Math.max(height, __lineHeight);
|
|
2176
|
-
|
|
2176
|
+
if (countRows > 1)
|
|
2177
|
+
drawData.overflow = countRows;
|
|
2177
2178
|
}
|
|
2178
2179
|
else if (height || autoSizeAlign) {
|
|
2179
2180
|
switch (verticalAlign) {
|
|
@@ -2185,7 +2186,7 @@ function layoutText(drawData, style) {
|
|
|
2185
2186
|
}
|
|
2186
2187
|
starY += y;
|
|
2187
2188
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
2188
|
-
for (let i = 0, len =
|
|
2189
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
2189
2190
|
row = rows[i];
|
|
2190
2191
|
row.x = x;
|
|
2191
2192
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -2254,7 +2255,7 @@ function clipText(drawData, style, x, width) {
|
|
|
2254
2255
|
if (i === end && charRight < right) {
|
|
2255
2256
|
break;
|
|
2256
2257
|
}
|
|
2257
|
-
else if (charRight < right && char.char !== ' ') {
|
|
2258
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
2258
2259
|
row.data.splice(i + 1);
|
|
2259
2260
|
row.width -= char.width;
|
|
2260
2261
|
break;
|