@wcardinal/wcardinal-ui 0.459.0-beta.0 → 0.459.0-beta.2
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/types/wcardinal/ui/shape/e-shape-boundary.d.ts +10 -0
- package/dist/types/wcardinal/ui/shape/e-shape-points-formatted.d.ts +3 -3
- package/dist/types/wcardinal/ui/shape/e-shape-points-formatters.d.ts +2 -1
- package/dist/types/wcardinal/ui/shape/e-shape-points-style.d.ts +4 -2
- package/dist/types/wcardinal/ui/shape/index.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/variant/build-polygon.d.ts +4 -1
- package/dist/types/wcardinal/ui/shape/variant/e-shape-line-points.d.ts +3 -2
- package/dist/types/wcardinal/ui/shape/variant/e-shape-polygon-triangulated-impl.d.ts +5 -2
- package/dist/types/wcardinal/ui/shape/variant/e-shape-polygon-triangulated.d.ts +11 -9
- package/dist/wcardinal/ui/shape/e-shape-boundary.js +6 -0
- package/dist/wcardinal/ui/shape/e-shape-boundary.js.map +1 -0
- package/dist/wcardinal/ui/shape/e-shape-points-formatted.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-points-formatters.js +2 -2
- package/dist/wcardinal/ui/shape/e-shape-points-formatters.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-points-style.js +4 -2
- package/dist/wcardinal/ui/shape/e-shape-points-style.js.map +1 -1
- package/dist/wcardinal/ui/shape/index.js +1 -0
- package/dist/wcardinal/ui/shape/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/build-polygon.js +27 -36
- package/dist/wcardinal/ui/shape/variant/build-polygon.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/builder-polygon.js +1 -2
- package/dist/wcardinal/ui/shape/variant/builder-polygon.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-line-points.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-polygon-triangulated-impl.js +25 -9
- package/dist/wcardinal/ui/shape/variant/e-shape-polygon-triangulated-impl.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-polygon-triangulated.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/hit-test-polygon.js +58 -34
- package/dist/wcardinal/ui/shape/variant/hit-test-polygon.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +118 -86
- package/dist/wcardinal-ui.js +118 -86
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.459.0-beta.
|
|
2
|
+
Winter Cardinal UI v0.459.0-beta.2
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -1391,16 +1391,18 @@ var EShapePointsStyle = {
|
|
|
1391
1391
|
DASHED_LOOSELY: DASHED_LOOSELY,
|
|
1392
1392
|
/** @deprecated in favor of EShapeStrokeStyle. */
|
|
1393
1393
|
DASHED_MASK: DASHED | DASHED_DENSELY | DASHED_LOOSELY,
|
|
1394
|
-
/** @deprecated in favor of
|
|
1394
|
+
/** @deprecated in favor of {@link CURVE_BEZIER_QUADRATIC}. */
|
|
1395
1395
|
CURVE: CURVE_SPLINE,
|
|
1396
|
+
/** @deprecated in favor of {@link CURVE_BEZIER_QUADRATIC}. */
|
|
1396
1397
|
CURVE_SPLINE: CURVE_SPLINE,
|
|
1397
1398
|
CURVE_BEZIER_QUADRATIC: CURVE_BEZIER_QUADRATIC,
|
|
1398
1399
|
FORMATTER_SHIFT: FORMATTER_SHIFT,
|
|
1399
1400
|
FORMATTER_MASK: FORMATTER_MASK,
|
|
1400
1401
|
FORMATTER_EXTENSION_LOWEST: FORMATTER_EXTENSION_LOWEST,
|
|
1401
1402
|
FORMATTER_EXTENSION_HIGHEST: FORMATTER_EXTENSION_HIGHEST,
|
|
1402
|
-
/** @deprecated in favor of
|
|
1403
|
+
/** @deprecated in favor of {@link FORMATTER_CURVE_BEZIER_QUADRATIC}. */
|
|
1403
1404
|
FORMATTER_CURVE: FORMATTER_CURVE_SPLINE,
|
|
1405
|
+
/** @deprecated in favor of {@link FORMATTER_CURVE_BEZIER_QUADRATIC}. */
|
|
1404
1406
|
FORMATTER_CURVE_SPLINE: FORMATTER_CURVE_SPLINE,
|
|
1405
1407
|
FORMATTER_CURVE_BEZIER_QUADRATIC: FORMATTER_CURVE_BEZIER_QUADRATIC
|
|
1406
1408
|
};
|
|
@@ -14361,11 +14363,11 @@ var EShapePointsFormatters = /** @class */ (function () {
|
|
|
14361
14363
|
}
|
|
14362
14364
|
this.data.set(id, datum);
|
|
14363
14365
|
};
|
|
14364
|
-
EShapePointsFormatters.get = function (
|
|
14366
|
+
EShapePointsFormatters.get = function (id) {
|
|
14365
14367
|
if (this.data == null) {
|
|
14366
14368
|
this.data = this.newData();
|
|
14367
14369
|
}
|
|
14368
|
-
return this.data.get(
|
|
14370
|
+
return this.data.get(id);
|
|
14369
14371
|
};
|
|
14370
14372
|
EShapePointsFormatters.each = function (iteratee) {
|
|
14371
14373
|
if (this.data == null) {
|
|
@@ -48660,58 +48662,49 @@ var buildPolygonVertex = function (vertices, polygonVertices, voffset, internalT
|
|
|
48660
48662
|
/**
|
|
48661
48663
|
* Build step buffer for polygons.
|
|
48662
48664
|
*/
|
|
48663
|
-
var buildPolygonStep = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount,
|
|
48665
|
+
var buildPolygonStep = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, polygonBoundary, voffset, vertexCount, fillDirection, fillPercent, strokeWidth, strokeSide, strokeStyle) {
|
|
48664
48666
|
var scaleInvariant = toScaleInvariant(strokeStyle);
|
|
48665
48667
|
var dash = toDash(strokeStyle);
|
|
48666
48668
|
var w = (strokeSide & EShapeStrokeSide.ALL) === EShapeStrokeSide.ALL ? 1 : 0;
|
|
48667
48669
|
var e = toPackedI4x64(7 + dash, scaleInvariant, w, 0);
|
|
48668
48670
|
var fp = Math.max(0, Math.min(1, fillPercent));
|
|
48669
|
-
var ax = Math.abs(sizeX);
|
|
48670
|
-
var ay = Math.abs(sizeY);
|
|
48671
|
-
var is = voffset * 6 - 1;
|
|
48672
48671
|
switch (fillDirection) {
|
|
48673
48672
|
case EShapeFillDirection.TOP:
|
|
48674
|
-
|
|
48675
|
-
steps[++is] = strokeWidth;
|
|
48676
|
-
steps[++is] = e;
|
|
48677
|
-
steps[++is] = polygonDistances[i];
|
|
48678
|
-
steps[++is] = ay * (fp - polygonUvs[j]);
|
|
48679
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48680
|
-
steps[++is] = polygonLengths[i];
|
|
48681
|
-
}
|
|
48673
|
+
buildPolygonStepY(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[3] - polygonBoundary[1], fp);
|
|
48682
48674
|
break;
|
|
48683
48675
|
case EShapeFillDirection.RIGHT:
|
|
48684
|
-
|
|
48685
|
-
steps[++is] = strokeWidth;
|
|
48686
|
-
steps[++is] = e;
|
|
48687
|
-
steps[++is] = polygonDistances[i];
|
|
48688
|
-
steps[++is] = ax * (fp - polygonUvs[j]);
|
|
48689
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48690
|
-
steps[++is] = polygonLengths[i];
|
|
48691
|
-
}
|
|
48676
|
+
buildPolygonStepX(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[0] - polygonBoundary[2], 1 - fp);
|
|
48692
48677
|
break;
|
|
48693
48678
|
case EShapeFillDirection.BOTTOM:
|
|
48694
|
-
|
|
48695
|
-
steps[++is] = strokeWidth;
|
|
48696
|
-
steps[++is] = e;
|
|
48697
|
-
steps[++is] = polygonDistances[i];
|
|
48698
|
-
steps[++is] = ay * (fp - (1 - polygonUvs[j]));
|
|
48699
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48700
|
-
steps[++is] = polygonLengths[i];
|
|
48701
|
-
}
|
|
48679
|
+
buildPolygonStepY(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[1] - polygonBoundary[3], 1 - fp);
|
|
48702
48680
|
break;
|
|
48703
48681
|
case EShapeFillDirection.LEFT:
|
|
48704
|
-
|
|
48705
|
-
steps[++is] = strokeWidth;
|
|
48706
|
-
steps[++is] = e;
|
|
48707
|
-
steps[++is] = polygonDistances[i];
|
|
48708
|
-
steps[++is] = ax * (fp - (1 - polygonUvs[j]));
|
|
48709
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48710
|
-
steps[++is] = polygonLengths[i];
|
|
48711
|
-
}
|
|
48682
|
+
buildPolygonStepX(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[2] - polygonBoundary[0], fp);
|
|
48712
48683
|
break;
|
|
48713
48684
|
}
|
|
48714
48685
|
};
|
|
48686
|
+
var buildPolygonStepX = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, afp, fp) {
|
|
48687
|
+
var is = voffset * 6 - 1;
|
|
48688
|
+
for (var i = 0, j = 0; i < vertexCount; i += 1, j += 2) {
|
|
48689
|
+
steps[++is] = strokeWidth;
|
|
48690
|
+
steps[++is] = e;
|
|
48691
|
+
steps[++is] = polygonDistances[i];
|
|
48692
|
+
steps[++is] = afp * (fp - polygonUvs[j]);
|
|
48693
|
+
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48694
|
+
steps[++is] = polygonLengths[i];
|
|
48695
|
+
}
|
|
48696
|
+
};
|
|
48697
|
+
var buildPolygonStepY = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, afp, fp) {
|
|
48698
|
+
var is = voffset * 6 - 1;
|
|
48699
|
+
for (var i = 0, j = 1; i < vertexCount; i += 1, j += 2) {
|
|
48700
|
+
steps[++is] = strokeWidth;
|
|
48701
|
+
steps[++is] = e;
|
|
48702
|
+
steps[++is] = polygonDistances[i];
|
|
48703
|
+
steps[++is] = afp * (fp - polygonUvs[j]);
|
|
48704
|
+
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48705
|
+
steps[++is] = polygonLengths[i];
|
|
48706
|
+
}
|
|
48707
|
+
};
|
|
48715
48708
|
/**
|
|
48716
48709
|
* Build UV buffer for polygons.
|
|
48717
48710
|
*/
|
|
@@ -50042,6 +50035,7 @@ var EShapePolygonTriangulatedImpl = /** @class */ (function () {
|
|
|
50042
50035
|
this._uvs = [];
|
|
50043
50036
|
this._indices = [];
|
|
50044
50037
|
this._nindices = 0;
|
|
50038
|
+
this._boundary = [0, 0, 0, 0];
|
|
50045
50039
|
}
|
|
50046
50040
|
Object.defineProperty(EShapePolygonTriangulatedImpl.prototype, "id", {
|
|
50047
50041
|
get: function () {
|
|
@@ -50115,6 +50109,14 @@ var EShapePolygonTriangulatedImpl = /** @class */ (function () {
|
|
|
50115
50109
|
enumerable: false,
|
|
50116
50110
|
configurable: true
|
|
50117
50111
|
});
|
|
50112
|
+
Object.defineProperty(EShapePolygonTriangulatedImpl.prototype, "boundary", {
|
|
50113
|
+
get: function () {
|
|
50114
|
+
this.triangulate();
|
|
50115
|
+
return this._boundary;
|
|
50116
|
+
},
|
|
50117
|
+
enumerable: false,
|
|
50118
|
+
configurable: true
|
|
50119
|
+
});
|
|
50118
50120
|
EShapePolygonTriangulatedImpl.prototype.set = function (parentPointsId, vertices, distances, lengths, clippings, uvs, indices) {
|
|
50119
50121
|
var isChanged = false;
|
|
50120
50122
|
// Parent Vertex ID
|
|
@@ -50205,26 +50207,32 @@ var EShapePolygonTriangulatedImpl = /** @class */ (function () {
|
|
|
50205
50207
|
this._parentPointsId = parentPointsId;
|
|
50206
50208
|
var buffer = UtilStraightSkeletonBuffer.from(UtilStraightSkeleton.from(parentPoints.formatted.values));
|
|
50207
50209
|
this._id += 1;
|
|
50208
|
-
|
|
50210
|
+
var vertices = buffer.vertices;
|
|
50211
|
+
this._vertices = vertices;
|
|
50209
50212
|
this._nvertices = buffer.vertices.length >> 1;
|
|
50210
50213
|
this._distances = buffer.distances;
|
|
50211
50214
|
this._lengths = buffer.lengths;
|
|
50212
50215
|
this._clippings = buffer.clippings;
|
|
50213
|
-
|
|
50216
|
+
var boundary = this._boundary;
|
|
50217
|
+
toPointsBoundary(vertices, boundary);
|
|
50218
|
+
this._uvs = this.toUvs(vertices, boundary);
|
|
50214
50219
|
this._indices = buffer.indices;
|
|
50215
50220
|
this._nindices = buffer.indices.length / 3;
|
|
50216
50221
|
}
|
|
50217
50222
|
};
|
|
50218
|
-
EShapePolygonTriangulatedImpl.prototype.toUvs = function (vertices) {
|
|
50223
|
+
EShapePolygonTriangulatedImpl.prototype.toUvs = function (vertices, boundary) {
|
|
50219
50224
|
var result = [];
|
|
50220
|
-
var
|
|
50221
|
-
var
|
|
50222
|
-
var
|
|
50223
|
-
var
|
|
50224
|
-
var
|
|
50225
|
+
var xmin = boundary[0];
|
|
50226
|
+
var ymin = boundary[1];
|
|
50227
|
+
var xmax = boundary[2];
|
|
50228
|
+
var ymax = boundary[3];
|
|
50229
|
+
var sx = xmax - xmin;
|
|
50230
|
+
var sy = ymax - ymin;
|
|
50231
|
+
var fx = 0 < sx ? 1 / sx : 0;
|
|
50232
|
+
var fy = 0 < sy ? 1 / sy : 0;
|
|
50225
50233
|
var verticesLength = vertices.length;
|
|
50226
50234
|
for (var i = 0; i < verticesLength; i += 2) {
|
|
50227
|
-
result.push(
|
|
50235
|
+
result.push((vertices[i] - xmin) * fx, (vertices[i + 1] - ymin) * fy);
|
|
50228
50236
|
}
|
|
50229
50237
|
return result;
|
|
50230
50238
|
};
|
|
@@ -50372,55 +50380,78 @@ var calcPolygonSquaredDistance = function (values, valuesLength, x, y) {
|
|
|
50372
50380
|
return result;
|
|
50373
50381
|
};
|
|
50374
50382
|
var hitTestPolygon = function (shape, x, y, ax, ay, sw, ss) {
|
|
50375
|
-
var
|
|
50383
|
+
var fill = shape.fill;
|
|
50384
|
+
var filled = fill.enable;
|
|
50376
50385
|
if (!filled && sw <= 0) {
|
|
50377
50386
|
return false;
|
|
50378
50387
|
}
|
|
50379
50388
|
var values = shape.points.values;
|
|
50380
50389
|
var valuesLength = values.length;
|
|
50381
50390
|
if (6 <= valuesLength) {
|
|
50382
|
-
|
|
50383
|
-
|
|
50384
|
-
|
|
50385
|
-
|
|
50386
|
-
|
|
50387
|
-
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
|
|
50394
|
-
|
|
50395
|
-
|
|
50396
|
-
|
|
50397
|
-
if (
|
|
50398
|
-
|
|
50399
|
-
|
|
50400
|
-
|
|
50401
|
-
if ((ppvy <= y && y < vy) || (y <= ppvy && vy < y)) {
|
|
50402
|
-
count += 1;
|
|
50403
|
-
}
|
|
50404
|
-
}
|
|
50405
|
-
else {
|
|
50391
|
+
var count = 0;
|
|
50392
|
+
var ppvy = values[valuesLength - 3];
|
|
50393
|
+
var pvx = values[valuesLength - 2];
|
|
50394
|
+
var pvy = values[valuesLength - 1];
|
|
50395
|
+
for (var i = 0; i < valuesLength; i += 2) {
|
|
50396
|
+
var vx = values[i];
|
|
50397
|
+
var vy = values[i + 1];
|
|
50398
|
+
if ((pvy <= y && y < vy) || (y <= pvy && vy < y)) {
|
|
50399
|
+
var dy = vy - pvy;
|
|
50400
|
+
var t = 0;
|
|
50401
|
+
if (0 < Math.abs(dy)) {
|
|
50402
|
+
t = (y - pvy) / dy;
|
|
50403
|
+
}
|
|
50404
|
+
var cx = pvx + t * (vx - pvx);
|
|
50405
|
+
if (x <= cx) {
|
|
50406
|
+
if (t <= 0) {
|
|
50407
|
+
// Since we could be just grazing vertices,
|
|
50408
|
+
// we need to check if the second-previous vertex is on the opposite side.
|
|
50409
|
+
if ((ppvy <= y && y < vy) || (y <= ppvy && vy < y)) {
|
|
50406
50410
|
count += 1;
|
|
50407
50411
|
}
|
|
50408
50412
|
}
|
|
50413
|
+
else {
|
|
50414
|
+
count += 1;
|
|
50415
|
+
}
|
|
50409
50416
|
}
|
|
50410
|
-
ppvy = pvy;
|
|
50411
|
-
pvx = vx;
|
|
50412
|
-
pvy = vy;
|
|
50413
50417
|
}
|
|
50414
|
-
|
|
50415
|
-
|
|
50418
|
+
ppvy = pvy;
|
|
50419
|
+
pvx = vx;
|
|
50420
|
+
pvy = vy;
|
|
50421
|
+
}
|
|
50422
|
+
if (count % 2 === 1) {
|
|
50423
|
+
if (filled) {
|
|
50424
|
+
var percent = fill.percent;
|
|
50425
|
+
if (1 <= percent) {
|
|
50416
50426
|
return true;
|
|
50417
50427
|
}
|
|
50418
|
-
|
|
50419
|
-
|
|
50420
|
-
|
|
50421
|
-
|
|
50428
|
+
var boundary = shape.triangulated.boundary;
|
|
50429
|
+
switch (fill.direction) {
|
|
50430
|
+
case EShapeFillDirection.TOP:
|
|
50431
|
+
if (y - boundary[1] <= percent * (boundary[3] - boundary[1])) {
|
|
50432
|
+
return true;
|
|
50433
|
+
}
|
|
50434
|
+
break;
|
|
50435
|
+
case EShapeFillDirection.RIGHT:
|
|
50436
|
+
if ((1 - percent) * (boundary[2] - boundary[0]) <= x - boundary[0]) {
|
|
50437
|
+
return true;
|
|
50438
|
+
}
|
|
50439
|
+
break;
|
|
50440
|
+
case EShapeFillDirection.BOTTOM:
|
|
50441
|
+
if ((1 - percent) * (boundary[3] - boundary[1]) <= y - boundary[1]) {
|
|
50442
|
+
return true;
|
|
50443
|
+
}
|
|
50444
|
+
break;
|
|
50445
|
+
case EShapeFillDirection.LEFT:
|
|
50446
|
+
if (x - boundary[0] <= percent * (boundary[2] - boundary[0])) {
|
|
50447
|
+
return true;
|
|
50448
|
+
}
|
|
50449
|
+
break;
|
|
50422
50450
|
}
|
|
50423
50451
|
}
|
|
50452
|
+
var sd = calcPolygonSquaredDistance(values, valuesLength, x, y);
|
|
50453
|
+
var s = sw * ss;
|
|
50454
|
+
return sd <= s * s;
|
|
50424
50455
|
}
|
|
50425
50456
|
}
|
|
50426
50457
|
return false;
|
|
@@ -50625,8 +50656,7 @@ var BuilderPolygon = /** @class */ (function (_super) {
|
|
|
50625
50656
|
// Steps
|
|
50626
50657
|
if (isNotInited || isTriangulatedIdChanged || isFillChanged || isStrokeChanged) {
|
|
50627
50658
|
buffer.updateSteps();
|
|
50628
|
-
|
|
50629
|
-
buildPolygonStep(buffer.steps, triangulated.distances, triangulated.lengths, triangulated.clippings, triangulated.uvs, voffset, this.vertexCount, size.x, size.y, fillDirection, fillPercent, strokeWidth, strokeSide, strokeStyle);
|
|
50659
|
+
buildPolygonStep(buffer.steps, triangulated.distances, triangulated.lengths, triangulated.clippings, triangulated.uvs, triangulated.boundary, voffset, this.vertexCount, fillDirection, fillPercent, strokeWidth, strokeSide, strokeStyle);
|
|
50630
50660
|
}
|
|
50631
50661
|
// UVs
|
|
50632
50662
|
if (isNotInited || isTriangulatedIdChanged || isTextureChanged) {
|
|
@@ -105859,6 +105889,8 @@ exports.buildNullUv = buildNullUv;
|
|
|
105859
105889
|
exports.buildNullVertex = buildNullVertex;
|
|
105860
105890
|
exports.buildPolygonIndex = buildPolygonIndex;
|
|
105861
105891
|
exports.buildPolygonStep = buildPolygonStep;
|
|
105892
|
+
exports.buildPolygonStepX = buildPolygonStepX;
|
|
105893
|
+
exports.buildPolygonStepY = buildPolygonStepY;
|
|
105862
105894
|
exports.buildPolygonUv = buildPolygonUv;
|
|
105863
105895
|
exports.buildPolygonVertex = buildPolygonVertex;
|
|
105864
105896
|
exports.buildRectangleIndex = buildRectangleIndex;
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.459.0-beta.
|
|
2
|
+
Winter Cardinal UI v0.459.0-beta.2
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -1388,16 +1388,18 @@
|
|
|
1388
1388
|
DASHED_LOOSELY: DASHED_LOOSELY,
|
|
1389
1389
|
/** @deprecated in favor of EShapeStrokeStyle. */
|
|
1390
1390
|
DASHED_MASK: DASHED | DASHED_DENSELY | DASHED_LOOSELY,
|
|
1391
|
-
/** @deprecated in favor of
|
|
1391
|
+
/** @deprecated in favor of {@link CURVE_BEZIER_QUADRATIC}. */
|
|
1392
1392
|
CURVE: CURVE_SPLINE,
|
|
1393
|
+
/** @deprecated in favor of {@link CURVE_BEZIER_QUADRATIC}. */
|
|
1393
1394
|
CURVE_SPLINE: CURVE_SPLINE,
|
|
1394
1395
|
CURVE_BEZIER_QUADRATIC: CURVE_BEZIER_QUADRATIC,
|
|
1395
1396
|
FORMATTER_SHIFT: FORMATTER_SHIFT,
|
|
1396
1397
|
FORMATTER_MASK: FORMATTER_MASK,
|
|
1397
1398
|
FORMATTER_EXTENSION_LOWEST: FORMATTER_EXTENSION_LOWEST,
|
|
1398
1399
|
FORMATTER_EXTENSION_HIGHEST: FORMATTER_EXTENSION_HIGHEST,
|
|
1399
|
-
/** @deprecated in favor of
|
|
1400
|
+
/** @deprecated in favor of {@link FORMATTER_CURVE_BEZIER_QUADRATIC}. */
|
|
1400
1401
|
FORMATTER_CURVE: FORMATTER_CURVE_SPLINE,
|
|
1402
|
+
/** @deprecated in favor of {@link FORMATTER_CURVE_BEZIER_QUADRATIC}. */
|
|
1401
1403
|
FORMATTER_CURVE_SPLINE: FORMATTER_CURVE_SPLINE,
|
|
1402
1404
|
FORMATTER_CURVE_BEZIER_QUADRATIC: FORMATTER_CURVE_BEZIER_QUADRATIC
|
|
1403
1405
|
};
|
|
@@ -14358,11 +14360,11 @@
|
|
|
14358
14360
|
}
|
|
14359
14361
|
this.data.set(id, datum);
|
|
14360
14362
|
};
|
|
14361
|
-
EShapePointsFormatters.get = function (
|
|
14363
|
+
EShapePointsFormatters.get = function (id) {
|
|
14362
14364
|
if (this.data == null) {
|
|
14363
14365
|
this.data = this.newData();
|
|
14364
14366
|
}
|
|
14365
|
-
return this.data.get(
|
|
14367
|
+
return this.data.get(id);
|
|
14366
14368
|
};
|
|
14367
14369
|
EShapePointsFormatters.each = function (iteratee) {
|
|
14368
14370
|
if (this.data == null) {
|
|
@@ -48657,58 +48659,49 @@
|
|
|
48657
48659
|
/**
|
|
48658
48660
|
* Build step buffer for polygons.
|
|
48659
48661
|
*/
|
|
48660
|
-
var buildPolygonStep = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount,
|
|
48662
|
+
var buildPolygonStep = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, polygonBoundary, voffset, vertexCount, fillDirection, fillPercent, strokeWidth, strokeSide, strokeStyle) {
|
|
48661
48663
|
var scaleInvariant = toScaleInvariant(strokeStyle);
|
|
48662
48664
|
var dash = toDash(strokeStyle);
|
|
48663
48665
|
var w = (strokeSide & EShapeStrokeSide.ALL) === EShapeStrokeSide.ALL ? 1 : 0;
|
|
48664
48666
|
var e = toPackedI4x64(7 + dash, scaleInvariant, w, 0);
|
|
48665
48667
|
var fp = Math.max(0, Math.min(1, fillPercent));
|
|
48666
|
-
var ax = Math.abs(sizeX);
|
|
48667
|
-
var ay = Math.abs(sizeY);
|
|
48668
|
-
var is = voffset * 6 - 1;
|
|
48669
48668
|
switch (fillDirection) {
|
|
48670
48669
|
case EShapeFillDirection.TOP:
|
|
48671
|
-
|
|
48672
|
-
steps[++is] = strokeWidth;
|
|
48673
|
-
steps[++is] = e;
|
|
48674
|
-
steps[++is] = polygonDistances[i];
|
|
48675
|
-
steps[++is] = ay * (fp - polygonUvs[j]);
|
|
48676
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48677
|
-
steps[++is] = polygonLengths[i];
|
|
48678
|
-
}
|
|
48670
|
+
buildPolygonStepY(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[3] - polygonBoundary[1], fp);
|
|
48679
48671
|
break;
|
|
48680
48672
|
case EShapeFillDirection.RIGHT:
|
|
48681
|
-
|
|
48682
|
-
steps[++is] = strokeWidth;
|
|
48683
|
-
steps[++is] = e;
|
|
48684
|
-
steps[++is] = polygonDistances[i];
|
|
48685
|
-
steps[++is] = ax * (fp - polygonUvs[j]);
|
|
48686
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48687
|
-
steps[++is] = polygonLengths[i];
|
|
48688
|
-
}
|
|
48673
|
+
buildPolygonStepX(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[0] - polygonBoundary[2], 1 - fp);
|
|
48689
48674
|
break;
|
|
48690
48675
|
case EShapeFillDirection.BOTTOM:
|
|
48691
|
-
|
|
48692
|
-
steps[++is] = strokeWidth;
|
|
48693
|
-
steps[++is] = e;
|
|
48694
|
-
steps[++is] = polygonDistances[i];
|
|
48695
|
-
steps[++is] = ay * (fp - (1 - polygonUvs[j]));
|
|
48696
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48697
|
-
steps[++is] = polygonLengths[i];
|
|
48698
|
-
}
|
|
48676
|
+
buildPolygonStepY(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[1] - polygonBoundary[3], 1 - fp);
|
|
48699
48677
|
break;
|
|
48700
48678
|
case EShapeFillDirection.LEFT:
|
|
48701
|
-
|
|
48702
|
-
steps[++is] = strokeWidth;
|
|
48703
|
-
steps[++is] = e;
|
|
48704
|
-
steps[++is] = polygonDistances[i];
|
|
48705
|
-
steps[++is] = ax * (fp - (1 - polygonUvs[j]));
|
|
48706
|
-
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48707
|
-
steps[++is] = polygonLengths[i];
|
|
48708
|
-
}
|
|
48679
|
+
buildPolygonStepX(steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, polygonBoundary[2] - polygonBoundary[0], fp);
|
|
48709
48680
|
break;
|
|
48710
48681
|
}
|
|
48711
48682
|
};
|
|
48683
|
+
var buildPolygonStepX = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, afp, fp) {
|
|
48684
|
+
var is = voffset * 6 - 1;
|
|
48685
|
+
for (var i = 0, j = 0; i < vertexCount; i += 1, j += 2) {
|
|
48686
|
+
steps[++is] = strokeWidth;
|
|
48687
|
+
steps[++is] = e;
|
|
48688
|
+
steps[++is] = polygonDistances[i];
|
|
48689
|
+
steps[++is] = afp * (fp - polygonUvs[j]);
|
|
48690
|
+
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48691
|
+
steps[++is] = polygonLengths[i];
|
|
48692
|
+
}
|
|
48693
|
+
};
|
|
48694
|
+
var buildPolygonStepY = function (steps, polygonDistances, polygonLengths, polygonClippings, polygonUvs, voffset, vertexCount, strokeWidth, e, afp, fp) {
|
|
48695
|
+
var is = voffset * 6 - 1;
|
|
48696
|
+
for (var i = 0, j = 1; i < vertexCount; i += 1, j += 2) {
|
|
48697
|
+
steps[++is] = strokeWidth;
|
|
48698
|
+
steps[++is] = e;
|
|
48699
|
+
steps[++is] = polygonDistances[i];
|
|
48700
|
+
steps[++is] = afp * (fp - polygonUvs[j]);
|
|
48701
|
+
steps[++is] = toPackedF2x1024(polygonClippings[i], 0);
|
|
48702
|
+
steps[++is] = polygonLengths[i];
|
|
48703
|
+
}
|
|
48704
|
+
};
|
|
48712
48705
|
/**
|
|
48713
48706
|
* Build UV buffer for polygons.
|
|
48714
48707
|
*/
|
|
@@ -50039,6 +50032,7 @@
|
|
|
50039
50032
|
this._uvs = [];
|
|
50040
50033
|
this._indices = [];
|
|
50041
50034
|
this._nindices = 0;
|
|
50035
|
+
this._boundary = [0, 0, 0, 0];
|
|
50042
50036
|
}
|
|
50043
50037
|
Object.defineProperty(EShapePolygonTriangulatedImpl.prototype, "id", {
|
|
50044
50038
|
get: function () {
|
|
@@ -50112,6 +50106,14 @@
|
|
|
50112
50106
|
enumerable: false,
|
|
50113
50107
|
configurable: true
|
|
50114
50108
|
});
|
|
50109
|
+
Object.defineProperty(EShapePolygonTriangulatedImpl.prototype, "boundary", {
|
|
50110
|
+
get: function () {
|
|
50111
|
+
this.triangulate();
|
|
50112
|
+
return this._boundary;
|
|
50113
|
+
},
|
|
50114
|
+
enumerable: false,
|
|
50115
|
+
configurable: true
|
|
50116
|
+
});
|
|
50115
50117
|
EShapePolygonTriangulatedImpl.prototype.set = function (parentPointsId, vertices, distances, lengths, clippings, uvs, indices) {
|
|
50116
50118
|
var isChanged = false;
|
|
50117
50119
|
// Parent Vertex ID
|
|
@@ -50202,26 +50204,32 @@
|
|
|
50202
50204
|
this._parentPointsId = parentPointsId;
|
|
50203
50205
|
var buffer = UtilStraightSkeletonBuffer.from(UtilStraightSkeleton.from(parentPoints.formatted.values));
|
|
50204
50206
|
this._id += 1;
|
|
50205
|
-
|
|
50207
|
+
var vertices = buffer.vertices;
|
|
50208
|
+
this._vertices = vertices;
|
|
50206
50209
|
this._nvertices = buffer.vertices.length >> 1;
|
|
50207
50210
|
this._distances = buffer.distances;
|
|
50208
50211
|
this._lengths = buffer.lengths;
|
|
50209
50212
|
this._clippings = buffer.clippings;
|
|
50210
|
-
|
|
50213
|
+
var boundary = this._boundary;
|
|
50214
|
+
toPointsBoundary(vertices, boundary);
|
|
50215
|
+
this._uvs = this.toUvs(vertices, boundary);
|
|
50211
50216
|
this._indices = buffer.indices;
|
|
50212
50217
|
this._nindices = buffer.indices.length / 3;
|
|
50213
50218
|
}
|
|
50214
50219
|
};
|
|
50215
|
-
EShapePolygonTriangulatedImpl.prototype.toUvs = function (vertices) {
|
|
50220
|
+
EShapePolygonTriangulatedImpl.prototype.toUvs = function (vertices, boundary) {
|
|
50216
50221
|
var result = [];
|
|
50217
|
-
var
|
|
50218
|
-
var
|
|
50219
|
-
var
|
|
50220
|
-
var
|
|
50221
|
-
var
|
|
50222
|
+
var xmin = boundary[0];
|
|
50223
|
+
var ymin = boundary[1];
|
|
50224
|
+
var xmax = boundary[2];
|
|
50225
|
+
var ymax = boundary[3];
|
|
50226
|
+
var sx = xmax - xmin;
|
|
50227
|
+
var sy = ymax - ymin;
|
|
50228
|
+
var fx = 0 < sx ? 1 / sx : 0;
|
|
50229
|
+
var fy = 0 < sy ? 1 / sy : 0;
|
|
50222
50230
|
var verticesLength = vertices.length;
|
|
50223
50231
|
for (var i = 0; i < verticesLength; i += 2) {
|
|
50224
|
-
result.push(
|
|
50232
|
+
result.push((vertices[i] - xmin) * fx, (vertices[i + 1] - ymin) * fy);
|
|
50225
50233
|
}
|
|
50226
50234
|
return result;
|
|
50227
50235
|
};
|
|
@@ -50369,55 +50377,78 @@
|
|
|
50369
50377
|
return result;
|
|
50370
50378
|
};
|
|
50371
50379
|
var hitTestPolygon = function (shape, x, y, ax, ay, sw, ss) {
|
|
50372
|
-
var
|
|
50380
|
+
var fill = shape.fill;
|
|
50381
|
+
var filled = fill.enable;
|
|
50373
50382
|
if (!filled && sw <= 0) {
|
|
50374
50383
|
return false;
|
|
50375
50384
|
}
|
|
50376
50385
|
var values = shape.points.values;
|
|
50377
50386
|
var valuesLength = values.length;
|
|
50378
50387
|
if (6 <= valuesLength) {
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
|
|
50382
|
-
|
|
50383
|
-
|
|
50384
|
-
|
|
50385
|
-
|
|
50386
|
-
|
|
50387
|
-
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
|
|
50394
|
-
if (
|
|
50395
|
-
|
|
50396
|
-
|
|
50397
|
-
|
|
50398
|
-
if ((ppvy <= y && y < vy) || (y <= ppvy && vy < y)) {
|
|
50399
|
-
count += 1;
|
|
50400
|
-
}
|
|
50401
|
-
}
|
|
50402
|
-
else {
|
|
50388
|
+
var count = 0;
|
|
50389
|
+
var ppvy = values[valuesLength - 3];
|
|
50390
|
+
var pvx = values[valuesLength - 2];
|
|
50391
|
+
var pvy = values[valuesLength - 1];
|
|
50392
|
+
for (var i = 0; i < valuesLength; i += 2) {
|
|
50393
|
+
var vx = values[i];
|
|
50394
|
+
var vy = values[i + 1];
|
|
50395
|
+
if ((pvy <= y && y < vy) || (y <= pvy && vy < y)) {
|
|
50396
|
+
var dy = vy - pvy;
|
|
50397
|
+
var t = 0;
|
|
50398
|
+
if (0 < Math.abs(dy)) {
|
|
50399
|
+
t = (y - pvy) / dy;
|
|
50400
|
+
}
|
|
50401
|
+
var cx = pvx + t * (vx - pvx);
|
|
50402
|
+
if (x <= cx) {
|
|
50403
|
+
if (t <= 0) {
|
|
50404
|
+
// Since we could be just grazing vertices,
|
|
50405
|
+
// we need to check if the second-previous vertex is on the opposite side.
|
|
50406
|
+
if ((ppvy <= y && y < vy) || (y <= ppvy && vy < y)) {
|
|
50403
50407
|
count += 1;
|
|
50404
50408
|
}
|
|
50405
50409
|
}
|
|
50410
|
+
else {
|
|
50411
|
+
count += 1;
|
|
50412
|
+
}
|
|
50406
50413
|
}
|
|
50407
|
-
ppvy = pvy;
|
|
50408
|
-
pvx = vx;
|
|
50409
|
-
pvy = vy;
|
|
50410
50414
|
}
|
|
50411
|
-
|
|
50412
|
-
|
|
50415
|
+
ppvy = pvy;
|
|
50416
|
+
pvx = vx;
|
|
50417
|
+
pvy = vy;
|
|
50418
|
+
}
|
|
50419
|
+
if (count % 2 === 1) {
|
|
50420
|
+
if (filled) {
|
|
50421
|
+
var percent = fill.percent;
|
|
50422
|
+
if (1 <= percent) {
|
|
50413
50423
|
return true;
|
|
50414
50424
|
}
|
|
50415
|
-
|
|
50416
|
-
|
|
50417
|
-
|
|
50418
|
-
|
|
50425
|
+
var boundary = shape.triangulated.boundary;
|
|
50426
|
+
switch (fill.direction) {
|
|
50427
|
+
case EShapeFillDirection.TOP:
|
|
50428
|
+
if (y - boundary[1] <= percent * (boundary[3] - boundary[1])) {
|
|
50429
|
+
return true;
|
|
50430
|
+
}
|
|
50431
|
+
break;
|
|
50432
|
+
case EShapeFillDirection.RIGHT:
|
|
50433
|
+
if ((1 - percent) * (boundary[2] - boundary[0]) <= x - boundary[0]) {
|
|
50434
|
+
return true;
|
|
50435
|
+
}
|
|
50436
|
+
break;
|
|
50437
|
+
case EShapeFillDirection.BOTTOM:
|
|
50438
|
+
if ((1 - percent) * (boundary[3] - boundary[1]) <= y - boundary[1]) {
|
|
50439
|
+
return true;
|
|
50440
|
+
}
|
|
50441
|
+
break;
|
|
50442
|
+
case EShapeFillDirection.LEFT:
|
|
50443
|
+
if (x - boundary[0] <= percent * (boundary[2] - boundary[0])) {
|
|
50444
|
+
return true;
|
|
50445
|
+
}
|
|
50446
|
+
break;
|
|
50419
50447
|
}
|
|
50420
50448
|
}
|
|
50449
|
+
var sd = calcPolygonSquaredDistance(values, valuesLength, x, y);
|
|
50450
|
+
var s = sw * ss;
|
|
50451
|
+
return sd <= s * s;
|
|
50421
50452
|
}
|
|
50422
50453
|
}
|
|
50423
50454
|
return false;
|
|
@@ -50622,8 +50653,7 @@
|
|
|
50622
50653
|
// Steps
|
|
50623
50654
|
if (isNotInited || isTriangulatedIdChanged || isFillChanged || isStrokeChanged) {
|
|
50624
50655
|
buffer.updateSteps();
|
|
50625
|
-
|
|
50626
|
-
buildPolygonStep(buffer.steps, triangulated.distances, triangulated.lengths, triangulated.clippings, triangulated.uvs, voffset, this.vertexCount, size.x, size.y, fillDirection, fillPercent, strokeWidth, strokeSide, strokeStyle);
|
|
50656
|
+
buildPolygonStep(buffer.steps, triangulated.distances, triangulated.lengths, triangulated.clippings, triangulated.uvs, triangulated.boundary, voffset, this.vertexCount, fillDirection, fillPercent, strokeWidth, strokeSide, strokeStyle);
|
|
50627
50657
|
}
|
|
50628
50658
|
// UVs
|
|
50629
50659
|
if (isNotInited || isTriangulatedIdChanged || isTextureChanged) {
|
|
@@ -83341,6 +83371,8 @@
|
|
|
83341
83371
|
buildPolygonIndex: buildPolygonIndex,
|
|
83342
83372
|
buildPolygonVertex: buildPolygonVertex,
|
|
83343
83373
|
buildPolygonStep: buildPolygonStep,
|
|
83374
|
+
buildPolygonStepX: buildPolygonStepX,
|
|
83375
|
+
buildPolygonStepY: buildPolygonStepY,
|
|
83344
83376
|
buildPolygonUv: buildPolygonUv,
|
|
83345
83377
|
RECTANGLE_ROUNDED_VERTEX_COUNT: RECTANGLE_ROUNDED_VERTEX_COUNT,
|
|
83346
83378
|
RECTANGLE_ROUNDED_INDEX_COUNT: RECTANGLE_ROUNDED_INDEX_COUNT,
|