@visactor/vrender-kits 0.22.10 → 0.22.12
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/cjs/canvas/contributions/browser/context.d.ts +3 -2
- package/cjs/canvas/contributions/browser/context.js +23 -16
- package/cjs/canvas/contributions/browser/context.js.map +1 -1
- package/cjs/render/contributions/rough/base-render.d.ts +4 -1
- package/cjs/render/contributions/rough/base-render.js +53 -0
- package/cjs/render/contributions/rough/base-render.js.map +1 -1
- package/cjs/render/contributions/rough/config.js +4 -4
- package/cjs/render/contributions/rough/config.js.map +1 -1
- package/cjs/render/contributions/rough/context.d.ts +142 -0
- package/cjs/render/contributions/rough/context.js +408 -0
- package/cjs/render/contributions/rough/context.js.map +1 -0
- package/cjs/render/contributions/rough/rough-line.d.ts +6 -4
- package/cjs/render/contributions/rough/rough-line.js +14 -48
- package/cjs/render/contributions/rough/rough-line.js.map +1 -1
- package/cjs/render/contributions/rough/rough-rect.d.ts +1 -1
- package/cjs/render/contributions/rough/rough-rect.js +2 -44
- package/cjs/render/contributions/rough/rough-rect.js.map +1 -1
- package/cjs/render/contributions/rough/rough-symbol.d.ts +3 -4
- package/cjs/render/contributions/rough/rough-symbol.js +3 -47
- package/cjs/render/contributions/rough/rough-symbol.js.map +1 -1
- package/dist/index.es.js +509 -186
- package/es/canvas/contributions/browser/context.d.ts +3 -2
- package/es/canvas/contributions/browser/context.js +23 -16
- package/es/canvas/contributions/browser/context.js.map +1 -1
- package/es/render/contributions/rough/base-render.d.ts +4 -1
- package/es/render/contributions/rough/base-render.js +53 -0
- package/es/render/contributions/rough/base-render.js.map +1 -1
- package/es/render/contributions/rough/config.js +4 -4
- package/es/render/contributions/rough/config.js.map +1 -1
- package/es/render/contributions/rough/context.d.ts +142 -0
- package/es/render/contributions/rough/context.js +402 -0
- package/es/render/contributions/rough/context.js.map +1 -0
- package/es/render/contributions/rough/rough-line.d.ts +6 -4
- package/es/render/contributions/rough/rough-line.js +15 -48
- package/es/render/contributions/rough/rough-line.js.map +1 -1
- package/es/render/contributions/rough/rough-rect.d.ts +1 -1
- package/es/render/contributions/rough/rough-rect.js +1 -43
- package/es/render/contributions/rough/rough-rect.js.map +1 -1
- package/es/render/contributions/rough/rough-symbol.d.ts +3 -4
- package/es/render/contributions/rough/rough-symbol.js +4 -46
- package/es/render/contributions/rough/rough-symbol.js.map +1 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { injectable, inject, DefaultCanvasArcRender, ARC_NUMBER_TYPE,
|
|
1
|
+
import { CustomPath2D, injectable, inject, DefaultCanvasArcRender, ARC_NUMBER_TYPE, drawArcPath, DefaultCanvasAreaRender, drawAreaSegments, DefaultCanvasCircleRender, CIRCLE_NUMBER_TYPE, DefaultCanvasLineRender, LINE_NUMBER_TYPE, DefaultCanvasPathRender, PATH_NUMBER_TYPE, DefaultCanvasRectRender, RECT_NUMBER_TYPE, DefaultCanvasSymbolRender, SYMBOL_NUMBER_TYPE, ContainerModule, GraphicRender, graphicCreator, Group, clock, application, WILDCARD, DefaultFillStyle, DefaultStrokeStyle, DefaultTextStyle, matrixAllocate, transformMat4, createColor, getScaledStroke, createConicalGradient, BaseCanvas, CanvasFactory, Context2dFactory, ContributionProvider, named, DrawContribution, PickItemInterceptor, PickServiceInterceptor, DefaultPickService, canvasAllocate, GROUP_NUMBER_TYPE, bindContributionProvider, PickerService, WindowHandlerContribution, BaseWindowHandlerContribution, BaseEnvContribution, Generator, EnvContribution, container, VGlobal, EmptyContext2d, ArcRender, AreaRender, AREA_NUMBER_TYPE, CircleRender, GLYPH_NUMBER_TYPE, GlyphRender, IMAGE_NUMBER_TYPE, LineRender, PolygonRender, POLYGON_NUMBER_TYPE, PathRender, RectRender, SymbolRender, TEXT_NUMBER_TYPE, rafBasedSto, vglobal, RafBasedSTO, BaseRender, mat4Allocate, TextRender, textLayoutOffsetY, textDrawOffsetX, RichTextRender, RICHTEXT_NUMBER_TYPE, ImageRender, Rect3DRender, RECT3D_NUMBER_TYPE, Arc3dRender, ARC3D_NUMBER_TYPE, Pyramid3dRender, PYRAMID3D_NUMBER_TYPE, Image as Image$1, ResourceLoader, ImageRenderContribution, DefaultCanvasImageRender, getTheme, DefaultRectRenderContribution, BaseRenderContributionTime, NOWORK_ANIMATE_ATTR, Rect, isBrowserEnv, registerArcGraphic, arcModule, registerArc3dGraphic, registerDirectionalLight, registerOrthoCamera, arc3dModule, registerAreaGraphic, areaModule, registerCircleGraphic, circleModule, registerGlyphGraphic, glyphModule, registerGroupGraphic, registerImageGraphic, imageModule, registerLineGraphic, lineModule, registerPathGraphic, pathModule, registerPolygonGraphic, polygonModule, registerPyramid3dGraphic, pyramid3dModule, registerRectGraphic, rectModule, registerRect3dGraphic, rect3dModule, registerRichtextGraphic, richtextModule, registerShadowRootGraphic, registerSymbolGraphic, symbolModule, registerTextGraphic, textModule, StarRender, STAR_NUMBER_TYPE, registerStarGraphic, starModule, registerWrapTextGraphic } from '@visactor/vrender-core';
|
|
2
2
|
import { isString, isArray, EventEmitter, Matrix, Logger, getContextFont, pi2, pi, AABBBounds, isValidNumber, isNumber, isFunction } from '@visactor/vutils';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
@@ -1524,12 +1524,12 @@ var U = {
|
|
|
1524
1524
|
|
|
1525
1525
|
const defaultRouthThemeSpec = {
|
|
1526
1526
|
maxRandomnessOffset: 3,
|
|
1527
|
-
roughness: 1,
|
|
1527
|
+
roughness: 1.6,
|
|
1528
1528
|
bowing: 1,
|
|
1529
1529
|
curveFitting: 0.95,
|
|
1530
1530
|
curveTightness: undefined,
|
|
1531
1531
|
curveStepCount: 9,
|
|
1532
|
-
fillStyle: '
|
|
1532
|
+
fillStyle: 'cross-hatch',
|
|
1533
1533
|
fillWeight: undefined,
|
|
1534
1534
|
hachureAngle: 60,
|
|
1535
1535
|
hachureGap: 6,
|
|
@@ -1537,21 +1537,493 @@ const defaultRouthThemeSpec = {
|
|
|
1537
1537
|
dashOffset: undefined,
|
|
1538
1538
|
dashGap: undefined,
|
|
1539
1539
|
zigzagOffset: undefined,
|
|
1540
|
-
seed:
|
|
1540
|
+
seed: 3,
|
|
1541
1541
|
fillLineDash: undefined,
|
|
1542
1542
|
fillLineDashOffset: undefined,
|
|
1543
1543
|
disableMultiStroke: false,
|
|
1544
|
-
disableMultiStrokeFill:
|
|
1544
|
+
disableMultiStrokeFill: true,
|
|
1545
1545
|
preserveVertices: true,
|
|
1546
1546
|
fixedDecimalPlaceDigits: undefined
|
|
1547
1547
|
};
|
|
1548
1548
|
|
|
1549
|
+
class RoughContext2d {
|
|
1550
|
+
constructor(originContext, customPath) {
|
|
1551
|
+
this.originContext = originContext;
|
|
1552
|
+
this.customPath = customPath;
|
|
1553
|
+
}
|
|
1554
|
+
reset(setTransform = true) {
|
|
1555
|
+
return this.originContext.reset(setTransform);
|
|
1556
|
+
}
|
|
1557
|
+
beginPath() {
|
|
1558
|
+
this.originContext.beginPath();
|
|
1559
|
+
this.customPath.beginPath();
|
|
1560
|
+
}
|
|
1561
|
+
moveTo(x, y, z) {
|
|
1562
|
+
this.originContext.moveTo(x, y, z);
|
|
1563
|
+
this.customPath.moveTo(x, y);
|
|
1564
|
+
}
|
|
1565
|
+
lineTo(x, y, z) {
|
|
1566
|
+
this.originContext.lineTo(x, y, z);
|
|
1567
|
+
this.customPath.lineTo(x, y);
|
|
1568
|
+
}
|
|
1569
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, z) {
|
|
1570
|
+
this.originContext.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, z);
|
|
1571
|
+
this.customPath.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
|
|
1572
|
+
}
|
|
1573
|
+
quadraticCurveTo(cpx, cpy, x, y, z) {
|
|
1574
|
+
this.originContext.quadraticCurveTo(cpx, cpy, x, y, z);
|
|
1575
|
+
this.customPath.quadraticCurveTo(cpx, cpy, x, y);
|
|
1576
|
+
}
|
|
1577
|
+
arc(x, y, radius, startAngle, endAngle, anticlockwise, z) {
|
|
1578
|
+
this.originContext.arc(x, y, radius, startAngle, endAngle, anticlockwise, z);
|
|
1579
|
+
this.customPath.arc(x, y, radius, startAngle, endAngle, anticlockwise);
|
|
1580
|
+
}
|
|
1581
|
+
arcTo(x1, y1, x2, y2, radius) {
|
|
1582
|
+
this.originContext.arcTo(x1, y1, x2, y2, radius);
|
|
1583
|
+
this.customPath.arcTo(x1, y1, x2, y2, radius);
|
|
1584
|
+
}
|
|
1585
|
+
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
1586
|
+
this.originContext.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
1587
|
+
this.customPath.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
1588
|
+
}
|
|
1589
|
+
rect(x, y, w, h, z) {
|
|
1590
|
+
this.originContext.rect(x, y, w, h, z);
|
|
1591
|
+
this.customPath.rect(x, y, w, h);
|
|
1592
|
+
}
|
|
1593
|
+
closePath() {
|
|
1594
|
+
this.originContext.closePath();
|
|
1595
|
+
this.customPath.closePath();
|
|
1596
|
+
}
|
|
1597
|
+
get canvas() {
|
|
1598
|
+
return this.originContext.canvas;
|
|
1599
|
+
}
|
|
1600
|
+
set canvas(value) {
|
|
1601
|
+
this.originContext.canvas = value;
|
|
1602
|
+
}
|
|
1603
|
+
get camera() {
|
|
1604
|
+
return this.originContext.camera;
|
|
1605
|
+
}
|
|
1606
|
+
set camera(value) {
|
|
1607
|
+
this.originContext.camera = value;
|
|
1608
|
+
}
|
|
1609
|
+
get modelMatrix() {
|
|
1610
|
+
return this.originContext.modelMatrix;
|
|
1611
|
+
}
|
|
1612
|
+
set modelMatrix(value) {
|
|
1613
|
+
this.originContext.modelMatrix = value;
|
|
1614
|
+
}
|
|
1615
|
+
get nativeContext() {
|
|
1616
|
+
return this.originContext.nativeContext;
|
|
1617
|
+
}
|
|
1618
|
+
set nativeContext(value) {
|
|
1619
|
+
this.originContext.nativeContext = value;
|
|
1620
|
+
}
|
|
1621
|
+
get _inuse() {
|
|
1622
|
+
return this.originContext._inuse;
|
|
1623
|
+
}
|
|
1624
|
+
set _inuse(value) {
|
|
1625
|
+
this.originContext._inuse = value;
|
|
1626
|
+
}
|
|
1627
|
+
get inuse() {
|
|
1628
|
+
return this.originContext.inuse;
|
|
1629
|
+
}
|
|
1630
|
+
set inuse(value) {
|
|
1631
|
+
this.originContext.inuse = value;
|
|
1632
|
+
}
|
|
1633
|
+
get stack() {
|
|
1634
|
+
return this.originContext.stack;
|
|
1635
|
+
}
|
|
1636
|
+
set stack(value) {
|
|
1637
|
+
this.originContext.stack = value;
|
|
1638
|
+
}
|
|
1639
|
+
get disableFill() {
|
|
1640
|
+
return this.originContext.disableFill;
|
|
1641
|
+
}
|
|
1642
|
+
set disableFill(value) {
|
|
1643
|
+
this.originContext.disableFill = value;
|
|
1644
|
+
}
|
|
1645
|
+
get disableStroke() {
|
|
1646
|
+
return this.originContext.disableStroke;
|
|
1647
|
+
}
|
|
1648
|
+
set disableStroke(value) {
|
|
1649
|
+
this.originContext.disableStroke = value;
|
|
1650
|
+
}
|
|
1651
|
+
get disableBeginPath() {
|
|
1652
|
+
return this.originContext.disableBeginPath;
|
|
1653
|
+
}
|
|
1654
|
+
set disableBeginPath(value) {
|
|
1655
|
+
this.originContext.disableBeginPath = value;
|
|
1656
|
+
}
|
|
1657
|
+
get fontFamily() {
|
|
1658
|
+
return this.originContext.fontFamily;
|
|
1659
|
+
}
|
|
1660
|
+
set fontFamily(value) {
|
|
1661
|
+
this.originContext.fontFamily = value;
|
|
1662
|
+
}
|
|
1663
|
+
get fontSize() {
|
|
1664
|
+
return this.originContext.fontSize;
|
|
1665
|
+
}
|
|
1666
|
+
set fontSize(value) {
|
|
1667
|
+
this.originContext.fontSize = value;
|
|
1668
|
+
}
|
|
1669
|
+
get _clearMatrix() {
|
|
1670
|
+
return this.originContext._clearMatrix;
|
|
1671
|
+
}
|
|
1672
|
+
set _clearMatrix(value) {
|
|
1673
|
+
this.originContext._clearMatrix = value;
|
|
1674
|
+
}
|
|
1675
|
+
get dpr() {
|
|
1676
|
+
return this.originContext.dpr;
|
|
1677
|
+
}
|
|
1678
|
+
set dpr(value) {
|
|
1679
|
+
this.originContext.dpr = value;
|
|
1680
|
+
}
|
|
1681
|
+
get baseGlobalAlpha() {
|
|
1682
|
+
return this.originContext.baseGlobalAlpha;
|
|
1683
|
+
}
|
|
1684
|
+
set baseGlobalAlpha(value) {
|
|
1685
|
+
this.originContext.baseGlobalAlpha = value;
|
|
1686
|
+
}
|
|
1687
|
+
get drawPromise() {
|
|
1688
|
+
return this.originContext.drawPromise;
|
|
1689
|
+
}
|
|
1690
|
+
set drawPromise(value) {
|
|
1691
|
+
this.originContext.drawPromise = value;
|
|
1692
|
+
}
|
|
1693
|
+
get mathTextMeasure() {
|
|
1694
|
+
return this.originContext.mathTextMeasure;
|
|
1695
|
+
}
|
|
1696
|
+
set mathTextMeasure(value) {
|
|
1697
|
+
this.originContext.mathTextMeasure = value;
|
|
1698
|
+
}
|
|
1699
|
+
get fillStyle() {
|
|
1700
|
+
return this.originContext.fillStyle;
|
|
1701
|
+
}
|
|
1702
|
+
set fillStyle(value) {
|
|
1703
|
+
this.originContext.fillStyle = value;
|
|
1704
|
+
}
|
|
1705
|
+
get font() {
|
|
1706
|
+
return this.originContext.font;
|
|
1707
|
+
}
|
|
1708
|
+
set font(value) {
|
|
1709
|
+
this.originContext.font = value;
|
|
1710
|
+
}
|
|
1711
|
+
get globalAlpha() {
|
|
1712
|
+
return this.originContext.globalAlpha;
|
|
1713
|
+
}
|
|
1714
|
+
set globalAlpha(value) {
|
|
1715
|
+
this.originContext.globalAlpha = value;
|
|
1716
|
+
}
|
|
1717
|
+
get lineCap() {
|
|
1718
|
+
return this.originContext.lineCap;
|
|
1719
|
+
}
|
|
1720
|
+
set lineCap(value) {
|
|
1721
|
+
this.originContext.lineCap = value;
|
|
1722
|
+
}
|
|
1723
|
+
get lineDashOffset() {
|
|
1724
|
+
return this.originContext.lineDashOffset;
|
|
1725
|
+
}
|
|
1726
|
+
set lineDashOffset(value) {
|
|
1727
|
+
this.originContext.lineDashOffset = value;
|
|
1728
|
+
}
|
|
1729
|
+
get lineJoin() {
|
|
1730
|
+
return this.originContext.lineJoin;
|
|
1731
|
+
}
|
|
1732
|
+
set lineJoin(value) {
|
|
1733
|
+
this.originContext.lineJoin = value;
|
|
1734
|
+
}
|
|
1735
|
+
get lineWidth() {
|
|
1736
|
+
return this.originContext.lineWidth;
|
|
1737
|
+
}
|
|
1738
|
+
set lineWidth(value) {
|
|
1739
|
+
this.originContext.lineWidth = value;
|
|
1740
|
+
}
|
|
1741
|
+
get miterLimit() {
|
|
1742
|
+
return this.originContext.miterLimit;
|
|
1743
|
+
}
|
|
1744
|
+
set miterLimit(value) {
|
|
1745
|
+
this.originContext.miterLimit = value;
|
|
1746
|
+
}
|
|
1747
|
+
get shadowBlur() {
|
|
1748
|
+
return this.originContext.shadowBlur;
|
|
1749
|
+
}
|
|
1750
|
+
set shadowBlur(value) {
|
|
1751
|
+
this.originContext.shadowBlur = value;
|
|
1752
|
+
}
|
|
1753
|
+
get shadowColor() {
|
|
1754
|
+
return this.originContext.shadowColor;
|
|
1755
|
+
}
|
|
1756
|
+
set shadowColor(value) {
|
|
1757
|
+
this.originContext.shadowColor = value;
|
|
1758
|
+
}
|
|
1759
|
+
get shadowOffsetX() {
|
|
1760
|
+
return this.originContext.shadowOffsetX;
|
|
1761
|
+
}
|
|
1762
|
+
set shadowOffsetX(value) {
|
|
1763
|
+
this.originContext.shadowOffsetX = value;
|
|
1764
|
+
}
|
|
1765
|
+
get shadowOffsetY() {
|
|
1766
|
+
return this.originContext.shadowOffsetY;
|
|
1767
|
+
}
|
|
1768
|
+
set shadowOffsetY(value) {
|
|
1769
|
+
this.originContext.shadowOffsetY = value;
|
|
1770
|
+
}
|
|
1771
|
+
get strokeStyle() {
|
|
1772
|
+
return this.originContext.strokeStyle;
|
|
1773
|
+
}
|
|
1774
|
+
set strokeStyle(value) {
|
|
1775
|
+
this.originContext.strokeStyle = value;
|
|
1776
|
+
}
|
|
1777
|
+
get textAlign() {
|
|
1778
|
+
return this.originContext.textAlign;
|
|
1779
|
+
}
|
|
1780
|
+
set textAlign(value) {
|
|
1781
|
+
this.originContext.textAlign = value;
|
|
1782
|
+
}
|
|
1783
|
+
get textBaseline() {
|
|
1784
|
+
return this.originContext.textBaseline;
|
|
1785
|
+
}
|
|
1786
|
+
set textBaseline(value) {
|
|
1787
|
+
this.originContext.textBaseline = value;
|
|
1788
|
+
}
|
|
1789
|
+
get currentMatrix() {
|
|
1790
|
+
return this.originContext.currentMatrix;
|
|
1791
|
+
}
|
|
1792
|
+
save() {
|
|
1793
|
+
return this.originContext.save();
|
|
1794
|
+
}
|
|
1795
|
+
restore() {
|
|
1796
|
+
return this.originContext.restore();
|
|
1797
|
+
}
|
|
1798
|
+
highPerformanceSave() {
|
|
1799
|
+
return this.originContext.highPerformanceSave();
|
|
1800
|
+
}
|
|
1801
|
+
highPerformanceRestore() {
|
|
1802
|
+
return this.originContext.highPerformanceRestore();
|
|
1803
|
+
}
|
|
1804
|
+
rotate(rad, setTransform) {
|
|
1805
|
+
return this.originContext.rotate(rad, setTransform);
|
|
1806
|
+
}
|
|
1807
|
+
scale(sx, sy, setTransform) {
|
|
1808
|
+
return this.originContext.scale(sx, sy, setTransform);
|
|
1809
|
+
}
|
|
1810
|
+
setScale(sx, sy, setTransform) {
|
|
1811
|
+
return this.originContext.setScale(sx, sy, setTransform);
|
|
1812
|
+
}
|
|
1813
|
+
scalePoint(sx, sy, px, py, setTransform) {
|
|
1814
|
+
return this.originContext.scalePoint(sx, sy, px, py, setTransform);
|
|
1815
|
+
}
|
|
1816
|
+
setTransform(a, b, c, d, e, f, setTransform, dpr) {
|
|
1817
|
+
return this.originContext.setTransform(a, b, c, d, e, f, setTransform, dpr);
|
|
1818
|
+
}
|
|
1819
|
+
setTransformFromMatrix(matrix, setTransform, dpr) {
|
|
1820
|
+
return this.originContext.setTransformFromMatrix(matrix, setTransform, dpr);
|
|
1821
|
+
}
|
|
1822
|
+
resetTransform(setTransform, dpr) {
|
|
1823
|
+
return this.originContext.resetTransform(setTransform, dpr);
|
|
1824
|
+
}
|
|
1825
|
+
transform(a, b, c, d, e, f, setTransform) {
|
|
1826
|
+
return this.originContext.transform(a, b, c, d, e, f, setTransform);
|
|
1827
|
+
}
|
|
1828
|
+
transformFromMatrix(matrix, setTransform) {
|
|
1829
|
+
return this.originContext.transformFromMatrix(matrix, setTransform);
|
|
1830
|
+
}
|
|
1831
|
+
translate(x, y, setTransform) {
|
|
1832
|
+
return this.originContext.translate(x, y, setTransform);
|
|
1833
|
+
}
|
|
1834
|
+
rotateDegrees(deg, setTransform) {
|
|
1835
|
+
return this.originContext.rotateDegrees(deg, setTransform);
|
|
1836
|
+
}
|
|
1837
|
+
rotateAbout(rad, x, y, setTransform) {
|
|
1838
|
+
return this.originContext.rotateAbout(rad, x, y, setTransform);
|
|
1839
|
+
}
|
|
1840
|
+
rotateDegreesAbout(deg, x, y, setTransform) {
|
|
1841
|
+
return this.originContext.rotateDegreesAbout(deg, x, y, setTransform);
|
|
1842
|
+
}
|
|
1843
|
+
setTransformForCurrent(force = false) {
|
|
1844
|
+
return this.originContext.setTransformForCurrent(force);
|
|
1845
|
+
}
|
|
1846
|
+
clip(path, fillRule) {
|
|
1847
|
+
return this.originContext.clip(path, fillRule);
|
|
1848
|
+
}
|
|
1849
|
+
fill(path, fillRule) {
|
|
1850
|
+
return this.originContext.fill(path, fillRule);
|
|
1851
|
+
}
|
|
1852
|
+
stroke(path) {
|
|
1853
|
+
return this.originContext.stroke(path);
|
|
1854
|
+
}
|
|
1855
|
+
fillRect(x, y, width, height) {
|
|
1856
|
+
return this.originContext.fillRect(x, y, width, height);
|
|
1857
|
+
}
|
|
1858
|
+
strokeRect(x, y, width, height) {
|
|
1859
|
+
return this.originContext.strokeRect(x, y, width, height);
|
|
1860
|
+
}
|
|
1861
|
+
fillText(text, x, y, z) {
|
|
1862
|
+
return this.originContext.fillText(text, x, y, z);
|
|
1863
|
+
}
|
|
1864
|
+
strokeText(text, x, y, z) {
|
|
1865
|
+
return this.originContext.strokeText(text, x, y, z);
|
|
1866
|
+
}
|
|
1867
|
+
clearRect(x, y, w, h) {
|
|
1868
|
+
return this.originContext.clearRect(x, y, w, h);
|
|
1869
|
+
}
|
|
1870
|
+
drawImage(...args) {
|
|
1871
|
+
return this.originContext.drawImage(...args);
|
|
1872
|
+
}
|
|
1873
|
+
createImageData(...args) {
|
|
1874
|
+
return this.originContext.createImageData(...args);
|
|
1875
|
+
}
|
|
1876
|
+
getImageData(sx, sy, sw, sh) {
|
|
1877
|
+
return this.originContext.getImageData(sx, sy, sw, sh);
|
|
1878
|
+
}
|
|
1879
|
+
putImageData(imagedata, dx, dy) {
|
|
1880
|
+
return this.originContext.putImageData(imagedata, dx, dy);
|
|
1881
|
+
}
|
|
1882
|
+
createLinearGradient(x0, y0, x1, y1) {
|
|
1883
|
+
return this.originContext.createLinearGradient(x0, y0, x1, y1);
|
|
1884
|
+
}
|
|
1885
|
+
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
1886
|
+
return this.originContext.createRadialGradient(x0, y0, r0, x1, y1, r1);
|
|
1887
|
+
}
|
|
1888
|
+
createConicGradient(x, y, startAngle, endAngle) {
|
|
1889
|
+
return this.originContext.createConicGradient(x, y, startAngle, endAngle);
|
|
1890
|
+
}
|
|
1891
|
+
createPattern(image, repetition) {
|
|
1892
|
+
return this.originContext.createPattern(image, repetition);
|
|
1893
|
+
}
|
|
1894
|
+
getLineDash() {
|
|
1895
|
+
return this.originContext.getLineDash();
|
|
1896
|
+
}
|
|
1897
|
+
setLineDash(segments) {
|
|
1898
|
+
return this.originContext.setLineDash(segments);
|
|
1899
|
+
}
|
|
1900
|
+
clear() {
|
|
1901
|
+
return this.originContext.clear();
|
|
1902
|
+
}
|
|
1903
|
+
measureText(text, method) {
|
|
1904
|
+
return this.originContext.measureText(text, method);
|
|
1905
|
+
}
|
|
1906
|
+
isPointInPath(x, y) {
|
|
1907
|
+
return this.originContext.isPointInPath(x, y);
|
|
1908
|
+
}
|
|
1909
|
+
isPointInStroke(x, y) {
|
|
1910
|
+
return this.originContext.isPointInStroke(x, y);
|
|
1911
|
+
}
|
|
1912
|
+
project(x, y, z) {
|
|
1913
|
+
return this.originContext.project(x, y, z);
|
|
1914
|
+
}
|
|
1915
|
+
view(x, y, z) {
|
|
1916
|
+
return this.originContext.view(x, y, z);
|
|
1917
|
+
}
|
|
1918
|
+
getCanvas() {
|
|
1919
|
+
return this.originContext.getCanvas();
|
|
1920
|
+
}
|
|
1921
|
+
getContext() {
|
|
1922
|
+
return this.originContext.getContext();
|
|
1923
|
+
}
|
|
1924
|
+
setCommonStyle(params, attribute, offsetX, offsetY, defaultParams) {
|
|
1925
|
+
return this.originContext.setCommonStyle(params, attribute, offsetX, offsetY, defaultParams);
|
|
1926
|
+
}
|
|
1927
|
+
setShadowBlendStyle(params, attribute, defaultParams) {
|
|
1928
|
+
return this.originContext.setShadowBlendStyle(params, attribute, defaultParams);
|
|
1929
|
+
}
|
|
1930
|
+
setStrokeStyle(params, attribute, offsetX, offsetY, defaultParams) {
|
|
1931
|
+
return this.originContext.setStrokeStyle(params, attribute, offsetX, offsetY, defaultParams);
|
|
1932
|
+
}
|
|
1933
|
+
setTextStyle(params, defaultParams, z) {
|
|
1934
|
+
return this.originContext.setTextStyle(params, defaultParams, z);
|
|
1935
|
+
}
|
|
1936
|
+
setTextStyleWithoutAlignBaseline(params, defaultParams, z) {
|
|
1937
|
+
return this.originContext.setTextStyleWithoutAlignBaseline(params, defaultParams, z);
|
|
1938
|
+
}
|
|
1939
|
+
clearMatrix(setTransform, dpr) {
|
|
1940
|
+
return this.originContext.clearMatrix(setTransform, dpr);
|
|
1941
|
+
}
|
|
1942
|
+
setClearMatrix(a, b, c, d, e, f) {
|
|
1943
|
+
return this.originContext.setClearMatrix(a, b, c, d, e, f);
|
|
1944
|
+
}
|
|
1945
|
+
onlyTranslate(dpr) {
|
|
1946
|
+
return this.originContext.onlyTranslate(dpr);
|
|
1947
|
+
}
|
|
1948
|
+
cloneMatrix(m) {
|
|
1949
|
+
return this.originContext.cloneMatrix(m);
|
|
1950
|
+
}
|
|
1951
|
+
draw() {
|
|
1952
|
+
return this.originContext.draw();
|
|
1953
|
+
}
|
|
1954
|
+
release(...params) {
|
|
1955
|
+
return this.originContext.release(...params);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
RoughContext2d.env = 'browser';
|
|
1959
|
+
|
|
1549
1960
|
class RoughBaseRender {
|
|
1550
1961
|
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
1551
1962
|
if (this.canvasRenderer.drawShape) {
|
|
1552
1963
|
return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
1553
1964
|
}
|
|
1554
1965
|
}
|
|
1966
|
+
doDraw(graphic, renderService, drawContext, params) {
|
|
1967
|
+
const { context } = drawContext;
|
|
1968
|
+
if (!context) {
|
|
1969
|
+
return;
|
|
1970
|
+
}
|
|
1971
|
+
const canvas = context.canvas.nativeCanvas;
|
|
1972
|
+
const rc = U.canvas(canvas);
|
|
1973
|
+
const customPath = new CustomPath2D();
|
|
1974
|
+
const roughContext = new RoughContext2d(context, customPath);
|
|
1975
|
+
context.save();
|
|
1976
|
+
context.transformFromMatrix(graphic.transMatrix, true);
|
|
1977
|
+
const { fill, stroke, roughStyle = {}, lineWidth } = graphic.attribute;
|
|
1978
|
+
const { maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = roughStyle;
|
|
1979
|
+
let rendered = false;
|
|
1980
|
+
const doRender = () => {
|
|
1981
|
+
if (rendered) {
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
rendered = true;
|
|
1985
|
+
const path = customPath.toString();
|
|
1986
|
+
context.beginPath();
|
|
1987
|
+
rc.path(path, {
|
|
1988
|
+
fill,
|
|
1989
|
+
stroke,
|
|
1990
|
+
strokeWidth: lineWidth,
|
|
1991
|
+
maxRandomnessOffset,
|
|
1992
|
+
roughness,
|
|
1993
|
+
bowing,
|
|
1994
|
+
curveFitting,
|
|
1995
|
+
curveTightness,
|
|
1996
|
+
curveStepCount,
|
|
1997
|
+
fillStyle,
|
|
1998
|
+
fillWeight,
|
|
1999
|
+
hachureAngle,
|
|
2000
|
+
hachureGap,
|
|
2001
|
+
simplification,
|
|
2002
|
+
dashOffset,
|
|
2003
|
+
dashGap,
|
|
2004
|
+
zigzagOffset,
|
|
2005
|
+
seed,
|
|
2006
|
+
fillLineDash,
|
|
2007
|
+
fillLineDashOffset,
|
|
2008
|
+
disableMultiStroke,
|
|
2009
|
+
disableMultiStrokeFill,
|
|
2010
|
+
preserveVertices,
|
|
2011
|
+
fixedDecimalPlaceDigits
|
|
2012
|
+
});
|
|
2013
|
+
};
|
|
2014
|
+
this.canvasRenderer.drawShape(graphic, roughContext, 0, 0, drawContext, params, () => {
|
|
2015
|
+
doRender();
|
|
2016
|
+
return false;
|
|
2017
|
+
}, () => {
|
|
2018
|
+
doRender();
|
|
2019
|
+
return false;
|
|
2020
|
+
});
|
|
2021
|
+
context.restore();
|
|
2022
|
+
}
|
|
2023
|
+
reInit() {
|
|
2024
|
+
var _a;
|
|
2025
|
+
(_a = this.canvasRenderer) === null || _a === void 0 ? void 0 : _a.reInit();
|
|
2026
|
+
}
|
|
1555
2027
|
}
|
|
1556
2028
|
|
|
1557
2029
|
let RoughCanvasArcRender = class RoughCanvasArcRender extends RoughBaseRender {
|
|
@@ -1726,69 +2198,22 @@ RoughCanvasCircleRender = __decorate([
|
|
|
1726
2198
|
__metadata("design:paramtypes", [Object])
|
|
1727
2199
|
], RoughCanvasCircleRender);
|
|
1728
2200
|
|
|
1729
|
-
let RoughCanvasLineRender = class RoughCanvasLineRender extends
|
|
1730
|
-
constructor() {
|
|
1731
|
-
super(
|
|
2201
|
+
let RoughCanvasLineRender = class RoughCanvasLineRender extends RoughBaseRender {
|
|
2202
|
+
constructor(canvasRenderer) {
|
|
2203
|
+
super();
|
|
2204
|
+
this.canvasRenderer = canvasRenderer;
|
|
1732
2205
|
this.style = 'rough';
|
|
2206
|
+
this.type = 'line';
|
|
2207
|
+
this.numberType = LINE_NUMBER_TYPE;
|
|
1733
2208
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
return super.drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb);
|
|
1737
|
-
}
|
|
1738
|
-
context.highPerformanceSave();
|
|
1739
|
-
const canvas = context.canvas.nativeCanvas;
|
|
1740
|
-
const rc = U.canvas(canvas, {});
|
|
1741
|
-
const customPath = new CustomPath2D();
|
|
1742
|
-
drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
|
|
1743
|
-
offsetX,
|
|
1744
|
-
offsetY
|
|
1745
|
-
});
|
|
1746
|
-
const { maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = attribute;
|
|
1747
|
-
let { fill: fillColor, stroke: strokeColor, lineWidth } = attribute;
|
|
1748
|
-
if (Array.isArray(defaultAttribute)) {
|
|
1749
|
-
defaultAttribute.forEach(item => {
|
|
1750
|
-
fillColor = fillColor !== null && fillColor !== void 0 ? fillColor : item.fill;
|
|
1751
|
-
strokeColor = strokeColor !== null && strokeColor !== void 0 ? strokeColor : item.stroke;
|
|
1752
|
-
lineWidth = lineWidth !== null && lineWidth !== void 0 ? lineWidth : item.lineWidth;
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
else {
|
|
1756
|
-
fillColor = fillColor !== null && fillColor !== void 0 ? fillColor : defaultAttribute.fill;
|
|
1757
|
-
strokeColor = strokeColor !== null && strokeColor !== void 0 ? strokeColor : defaultAttribute.stroke;
|
|
1758
|
-
lineWidth = lineWidth !== null && lineWidth !== void 0 ? lineWidth : defaultAttribute.lineWidth;
|
|
1759
|
-
}
|
|
1760
|
-
rc.path(customPath.toString(), {
|
|
1761
|
-
fill: fill ? fillColor : undefined,
|
|
1762
|
-
stroke: stroke ? strokeColor : undefined,
|
|
1763
|
-
strokeWidth: lineWidth,
|
|
1764
|
-
maxRandomnessOffset,
|
|
1765
|
-
roughness,
|
|
1766
|
-
bowing,
|
|
1767
|
-
curveFitting,
|
|
1768
|
-
curveTightness,
|
|
1769
|
-
curveStepCount,
|
|
1770
|
-
fillStyle,
|
|
1771
|
-
fillWeight,
|
|
1772
|
-
hachureAngle,
|
|
1773
|
-
hachureGap,
|
|
1774
|
-
simplification,
|
|
1775
|
-
dashOffset,
|
|
1776
|
-
dashGap,
|
|
1777
|
-
zigzagOffset,
|
|
1778
|
-
seed,
|
|
1779
|
-
fillLineDash,
|
|
1780
|
-
fillLineDashOffset,
|
|
1781
|
-
disableMultiStroke,
|
|
1782
|
-
disableMultiStrokeFill,
|
|
1783
|
-
preserveVertices,
|
|
1784
|
-
fixedDecimalPlaceDigits
|
|
1785
|
-
});
|
|
1786
|
-
context.highPerformanceRestore();
|
|
1787
|
-
return false;
|
|
2209
|
+
draw(line, renderService, drawContext, params) {
|
|
2210
|
+
this.doDraw(line, renderService, drawContext, params);
|
|
1788
2211
|
}
|
|
1789
2212
|
};
|
|
1790
2213
|
RoughCanvasLineRender = __decorate([
|
|
1791
|
-
injectable()
|
|
2214
|
+
injectable(),
|
|
2215
|
+
__param(0, inject(DefaultCanvasLineRender)),
|
|
2216
|
+
__metadata("design:paramtypes", [Object])
|
|
1792
2217
|
], RoughCanvasLineRender);
|
|
1793
2218
|
|
|
1794
2219
|
let RoughCanvasPathRender = class RoughCanvasPathRender extends RoughBaseRender {
|
|
@@ -1856,57 +2281,7 @@ let RoughCanvasRectRender = class RoughCanvasRectRender extends RoughBaseRender
|
|
|
1856
2281
|
this.numberType = RECT_NUMBER_TYPE;
|
|
1857
2282
|
}
|
|
1858
2283
|
draw(rect, renderService, drawContext, params) {
|
|
1859
|
-
|
|
1860
|
-
if (!context) {
|
|
1861
|
-
return;
|
|
1862
|
-
}
|
|
1863
|
-
const canvas = context.canvas.nativeCanvas;
|
|
1864
|
-
const rc = U.canvas(canvas);
|
|
1865
|
-
context.highPerformanceSave();
|
|
1866
|
-
const rectAttribute = rect.getGraphicTheme();
|
|
1867
|
-
let { x = rectAttribute.x, y = rectAttribute.y } = rect.attribute;
|
|
1868
|
-
if (!rect.transMatrix.onlyTranslate()) {
|
|
1869
|
-
x = 0;
|
|
1870
|
-
y = 0;
|
|
1871
|
-
context.transformFromMatrix(rect.transMatrix, true);
|
|
1872
|
-
}
|
|
1873
|
-
else {
|
|
1874
|
-
const { dx = rectAttribute.dx, dy = rectAttribute.dy } = rect.attribute;
|
|
1875
|
-
x += dx;
|
|
1876
|
-
y += dy;
|
|
1877
|
-
context.setTransformForCurrent();
|
|
1878
|
-
}
|
|
1879
|
-
const { fill = rectAttribute.fill, stroke = rectAttribute.stroke, fillColor = rectAttribute.fill, strokeColor = rectAttribute.stroke, x1, y1, lineWidth = rectAttribute.lineWidth, maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = rect.attribute;
|
|
1880
|
-
let { width = rectAttribute.width, height = rectAttribute.height } = rect.attribute;
|
|
1881
|
-
width = (width !== null && width !== void 0 ? width : x1 - x) || 0;
|
|
1882
|
-
height = (height !== null && height !== void 0 ? height : y1 - y) || 0;
|
|
1883
|
-
rc.rectangle(x, y, width, height, {
|
|
1884
|
-
fill: fill ? fillColor : undefined,
|
|
1885
|
-
stroke: stroke ? strokeColor : undefined,
|
|
1886
|
-
strokeWidth: lineWidth,
|
|
1887
|
-
maxRandomnessOffset,
|
|
1888
|
-
roughness,
|
|
1889
|
-
bowing,
|
|
1890
|
-
curveFitting,
|
|
1891
|
-
curveTightness,
|
|
1892
|
-
curveStepCount,
|
|
1893
|
-
fillStyle,
|
|
1894
|
-
fillWeight,
|
|
1895
|
-
hachureAngle,
|
|
1896
|
-
hachureGap,
|
|
1897
|
-
simplification,
|
|
1898
|
-
dashOffset,
|
|
1899
|
-
dashGap,
|
|
1900
|
-
zigzagOffset,
|
|
1901
|
-
seed,
|
|
1902
|
-
fillLineDash,
|
|
1903
|
-
fillLineDashOffset,
|
|
1904
|
-
disableMultiStroke,
|
|
1905
|
-
disableMultiStrokeFill,
|
|
1906
|
-
preserveVertices,
|
|
1907
|
-
fixedDecimalPlaceDigits
|
|
1908
|
-
});
|
|
1909
|
-
context.highPerformanceRestore();
|
|
2284
|
+
this.doDraw(rect, renderService, drawContext, params);
|
|
1910
2285
|
}
|
|
1911
2286
|
};
|
|
1912
2287
|
RoughCanvasRectRender = __decorate([
|
|
@@ -1915,7 +2290,7 @@ RoughCanvasRectRender = __decorate([
|
|
|
1915
2290
|
__metadata("design:paramtypes", [Object])
|
|
1916
2291
|
], RoughCanvasRectRender);
|
|
1917
2292
|
|
|
1918
|
-
let RoughCanvasSymbolRender = class RoughCanvasSymbolRender extends
|
|
2293
|
+
let RoughCanvasSymbolRender = class RoughCanvasSymbolRender extends RoughBaseRender {
|
|
1919
2294
|
constructor(canvasRenderer) {
|
|
1920
2295
|
super();
|
|
1921
2296
|
this.canvasRenderer = canvasRenderer;
|
|
@@ -1924,64 +2299,7 @@ let RoughCanvasSymbolRender = class RoughCanvasSymbolRender extends BaseRender {
|
|
|
1924
2299
|
this.style = 'rough';
|
|
1925
2300
|
}
|
|
1926
2301
|
draw(symbol, renderService, drawContext, params) {
|
|
1927
|
-
|
|
1928
|
-
if (!context) {
|
|
1929
|
-
return;
|
|
1930
|
-
}
|
|
1931
|
-
const canvas = context.canvas.nativeCanvas;
|
|
1932
|
-
const rc = U.canvas(canvas);
|
|
1933
|
-
context.highPerformanceSave();
|
|
1934
|
-
const symbolAttribute = symbol.getGraphicTheme();
|
|
1935
|
-
const data = this.transform(symbol, symbolAttribute, context);
|
|
1936
|
-
const { x, y, z, lastModelMatrix } = data;
|
|
1937
|
-
const parsedPath = symbol.getParsedPath();
|
|
1938
|
-
if (!parsedPath) {
|
|
1939
|
-
return;
|
|
1940
|
-
}
|
|
1941
|
-
const { fill = symbolAttribute.fill, stroke = symbolAttribute.stroke, fillColor = symbolAttribute.fill, strokeColor = symbolAttribute.stroke, size = symbolAttribute.size, lineWidth = symbolAttribute.lineWidth, maxRandomnessOffset = defaultRouthThemeSpec.maxRandomnessOffset, roughness = defaultRouthThemeSpec.roughness, bowing = defaultRouthThemeSpec.bowing, curveFitting = defaultRouthThemeSpec.curveFitting, curveTightness = defaultRouthThemeSpec.curveTightness, curveStepCount = defaultRouthThemeSpec.curveStepCount, fillStyle = defaultRouthThemeSpec.fillStyle, fillWeight = defaultRouthThemeSpec.fillWeight, hachureAngle = defaultRouthThemeSpec.hachureAngle, hachureGap = defaultRouthThemeSpec.hachureGap, simplification = defaultRouthThemeSpec.simplification, dashOffset = defaultRouthThemeSpec.dashOffset, dashGap = defaultRouthThemeSpec.dashGap, zigzagOffset = defaultRouthThemeSpec.zigzagOffset, seed = defaultRouthThemeSpec.seed, fillLineDash = defaultRouthThemeSpec.fillLineDash, fillLineDashOffset = defaultRouthThemeSpec.fillLineDashOffset, disableMultiStroke = defaultRouthThemeSpec.disableMultiStroke, disableMultiStrokeFill = defaultRouthThemeSpec.disableMultiStrokeFill, preserveVertices = defaultRouthThemeSpec.preserveVertices, fixedDecimalPlaceDigits = defaultRouthThemeSpec.fixedDecimalPlaceDigits } = symbol.attribute;
|
|
1942
|
-
let svgPath = '';
|
|
1943
|
-
if (parsedPath.drawToSvgPath) {
|
|
1944
|
-
svgPath = parsedPath.drawToSvgPath(size, x, y);
|
|
1945
|
-
}
|
|
1946
|
-
else {
|
|
1947
|
-
const customPath = new CustomPath2D();
|
|
1948
|
-
if (parsedPath.draw(customPath, size, x, y)) {
|
|
1949
|
-
customPath.closePath();
|
|
1950
|
-
}
|
|
1951
|
-
svgPath = customPath.toString();
|
|
1952
|
-
}
|
|
1953
|
-
rc.path(svgPath, {
|
|
1954
|
-
fill: fill ? fillColor : undefined,
|
|
1955
|
-
stroke: stroke ? strokeColor : undefined,
|
|
1956
|
-
strokeWidth: lineWidth,
|
|
1957
|
-
maxRandomnessOffset,
|
|
1958
|
-
roughness,
|
|
1959
|
-
bowing,
|
|
1960
|
-
curveFitting,
|
|
1961
|
-
curveTightness,
|
|
1962
|
-
curveStepCount,
|
|
1963
|
-
fillStyle,
|
|
1964
|
-
fillWeight,
|
|
1965
|
-
hachureAngle,
|
|
1966
|
-
hachureGap,
|
|
1967
|
-
simplification,
|
|
1968
|
-
dashOffset,
|
|
1969
|
-
dashGap,
|
|
1970
|
-
zigzagOffset,
|
|
1971
|
-
seed,
|
|
1972
|
-
fillLineDash,
|
|
1973
|
-
fillLineDashOffset,
|
|
1974
|
-
disableMultiStroke,
|
|
1975
|
-
disableMultiStrokeFill,
|
|
1976
|
-
preserveVertices,
|
|
1977
|
-
fixedDecimalPlaceDigits
|
|
1978
|
-
});
|
|
1979
|
-
context.highPerformanceRestore();
|
|
1980
|
-
}
|
|
1981
|
-
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
1982
|
-
if (this.canvasRenderer.drawShape) {
|
|
1983
|
-
return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
1984
|
-
}
|
|
2302
|
+
this.doDraw(symbol, renderService, drawContext, params);
|
|
1985
2303
|
}
|
|
1986
2304
|
};
|
|
1987
2305
|
RoughCanvasSymbolRender = __decorate([
|
|
@@ -2731,10 +3049,15 @@ let BrowserContext2d = class BrowserContext2d {
|
|
|
2731
3049
|
return this.nativeContext.fillStyle;
|
|
2732
3050
|
}
|
|
2733
3051
|
set font(d) {
|
|
3052
|
+
if (d === this._font) {
|
|
3053
|
+
return;
|
|
3054
|
+
}
|
|
3055
|
+
this._font = d;
|
|
2734
3056
|
this.nativeContext.font = d;
|
|
2735
3057
|
}
|
|
2736
3058
|
get font() {
|
|
2737
|
-
|
|
3059
|
+
var _a;
|
|
3060
|
+
return (_a = this._font) !== null && _a !== void 0 ? _a : this.nativeContext.font;
|
|
2738
3061
|
}
|
|
2739
3062
|
set globalAlpha(d) {
|
|
2740
3063
|
this.nativeContext.globalAlpha = d * this.baseGlobalAlpha;
|
|
@@ -2850,14 +3173,14 @@ let BrowserContext2d = class BrowserContext2d {
|
|
|
2850
3173
|
this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
2851
3174
|
this.baseGlobalAlpha = 1;
|
|
2852
3175
|
}
|
|
2853
|
-
reset() {
|
|
3176
|
+
reset(setTransform = true) {
|
|
2854
3177
|
if (this.stack.length) {
|
|
2855
3178
|
Logger.getInstance().warn('可能存在bug,matrix没有清空');
|
|
2856
3179
|
}
|
|
2857
3180
|
this.matrix.setValue(1, 0, 0, 1, 0, 0);
|
|
2858
3181
|
this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
2859
3182
|
this.stack.length = 0;
|
|
2860
|
-
this.nativeContext.setTransform(1, 0, 0, 1, 0, 0);
|
|
3183
|
+
setTransform && this.nativeContext.setTransform(1, 0, 0, 1, 0, 0);
|
|
2861
3184
|
}
|
|
2862
3185
|
getCanvas() {
|
|
2863
3186
|
return this.canvas;
|
|
@@ -2891,6 +3214,9 @@ let BrowserContext2d = class BrowserContext2d {
|
|
|
2891
3214
|
this.matrix = this.stack.pop();
|
|
2892
3215
|
this.setTransformForCurrent(true);
|
|
2893
3216
|
}
|
|
3217
|
+
this.font = '';
|
|
3218
|
+
this._clearFilterStyle = false;
|
|
3219
|
+
this._clearShadowStyle = false;
|
|
2894
3220
|
}
|
|
2895
3221
|
highPerformanceRestore() {
|
|
2896
3222
|
if (this.stack.length > 0) {
|
|
@@ -3353,11 +3679,12 @@ let BrowserContext2d = class BrowserContext2d {
|
|
|
3353
3679
|
if (!defaultParams) {
|
|
3354
3680
|
defaultParams = this.fillAttributes;
|
|
3355
3681
|
}
|
|
3356
|
-
const { opacity = defaultParams.opacity, shadowBlur = defaultParams.shadowBlur,
|
|
3682
|
+
const { opacity = defaultParams.opacity, shadowBlur = defaultParams.shadowBlur, shadowOffsetX = defaultParams.shadowOffsetX, shadowOffsetY = defaultParams.shadowOffsetY, blur = defaultParams.blur, globalCompositeOperation = defaultParams.globalCompositeOperation } = attribute;
|
|
3357
3683
|
if (opacity <= 1e-12) {
|
|
3358
3684
|
return;
|
|
3359
3685
|
}
|
|
3360
|
-
if (
|
|
3686
|
+
if (shadowOffsetX || shadowOffsetY || shadowBlur) {
|
|
3687
|
+
const { shadowColor = defaultParams.shadowColor, shadowOffsetX = defaultParams.shadowOffsetX, shadowOffsetY = defaultParams.shadowOffsetY } = attribute;
|
|
3361
3688
|
_context.shadowBlur = shadowBlur * this.dpr;
|
|
3362
3689
|
_context.shadowColor = shadowColor;
|
|
3363
3690
|
_context.shadowOffsetX = shadowOffsetX * this.dpr;
|
|
@@ -3373,10 +3700,6 @@ let BrowserContext2d = class BrowserContext2d {
|
|
|
3373
3700
|
_context.filter = `blur(${blur}px)`;
|
|
3374
3701
|
this._clearFilterStyle = true;
|
|
3375
3702
|
}
|
|
3376
|
-
else if (filter) {
|
|
3377
|
-
_context.filter = filter;
|
|
3378
|
-
this._clearFilterStyle = true;
|
|
3379
|
-
}
|
|
3380
3703
|
else if (this._clearFilterStyle) {
|
|
3381
3704
|
_context.filter = 'blur(0px)';
|
|
3382
3705
|
this._clearFilterStyle = false;
|
|
@@ -3433,10 +3756,10 @@ let BrowserContext2d = class BrowserContext2d {
|
|
|
3433
3756
|
}
|
|
3434
3757
|
const { scaleIn3d = defaultParams.scaleIn3d } = params;
|
|
3435
3758
|
if (params.font) {
|
|
3436
|
-
|
|
3759
|
+
this.font = params.font;
|
|
3437
3760
|
}
|
|
3438
3761
|
else {
|
|
3439
|
-
|
|
3762
|
+
this.font = getContextFont(params, defaultParams, scaleIn3d && this.camera && this.camera.getProjectionScale(z));
|
|
3440
3763
|
}
|
|
3441
3764
|
const { fontFamily = defaultParams.fontFamily, fontSize = defaultParams.fontSize } = params;
|
|
3442
3765
|
this.fontFamily = fontFamily;
|
|
@@ -3451,10 +3774,10 @@ let BrowserContext2d = class BrowserContext2d {
|
|
|
3451
3774
|
defaultParams = this.textAttributes;
|
|
3452
3775
|
}
|
|
3453
3776
|
if (params.font) {
|
|
3454
|
-
|
|
3777
|
+
this.font = params.font;
|
|
3455
3778
|
}
|
|
3456
3779
|
else {
|
|
3457
|
-
|
|
3780
|
+
this.font = getContextFont(params, defaultParams, this.camera && this.camera.getProjectionScale(z));
|
|
3458
3781
|
}
|
|
3459
3782
|
const { fontFamily = defaultParams.fontFamily, fontSize = defaultParams.fontSize } = params;
|
|
3460
3783
|
this.fontFamily = fontFamily;
|