@visactor/vrender-components 0.15.3-alpha.9 → 0.15.4

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.
Files changed (47) hide show
  1. package/cjs/brush/brush.d.ts +5 -0
  2. package/cjs/brush/brush.js +18 -14
  3. package/cjs/brush/brush.js.map +1 -1
  4. package/cjs/brush/config.d.ts +5 -0
  5. package/cjs/brush/config.js +5 -0
  6. package/cjs/brush/config.js.map +1 -1
  7. package/cjs/brush/type.d.ts +6 -1
  8. package/cjs/brush/type.js.map +1 -1
  9. package/cjs/data-zoom/data-zoom.d.ts +1 -0
  10. package/cjs/data-zoom/data-zoom.js +14 -3
  11. package/cjs/data-zoom/data-zoom.js.map +1 -1
  12. package/cjs/index.d.ts +1 -1
  13. package/cjs/index.js +1 -1
  14. package/cjs/index.js.map +1 -1
  15. package/cjs/label/base.js +28 -17
  16. package/cjs/label/base.js.map +1 -1
  17. package/cjs/label/type.d.ts +1 -0
  18. package/cjs/label/type.js.map +1 -1
  19. package/cjs/legend/discrete/discrete.js +1 -1
  20. package/cjs/legend/discrete/discrete.js.map +1 -1
  21. package/cjs/util/label-smartInvert.js +3 -2
  22. package/cjs/util/label-smartInvert.js.map +1 -1
  23. package/dist/index.js +75 -41
  24. package/dist/index.min.js +1 -1
  25. package/es/brush/brush.d.ts +5 -0
  26. package/es/brush/brush.js +17 -14
  27. package/es/brush/brush.js.map +1 -1
  28. package/es/brush/config.d.ts +5 -0
  29. package/es/brush/config.js +5 -0
  30. package/es/brush/config.js.map +1 -1
  31. package/es/brush/type.d.ts +6 -1
  32. package/es/brush/type.js.map +1 -1
  33. package/es/data-zoom/data-zoom.d.ts +1 -0
  34. package/es/data-zoom/data-zoom.js +15 -4
  35. package/es/data-zoom/data-zoom.js.map +1 -1
  36. package/es/index.d.ts +1 -1
  37. package/es/index.js +1 -1
  38. package/es/index.js.map +1 -1
  39. package/es/label/base.js +28 -17
  40. package/es/label/base.js.map +1 -1
  41. package/es/label/type.d.ts +1 -0
  42. package/es/label/type.js.map +1 -1
  43. package/es/legend/discrete/discrete.js +1 -1
  44. package/es/legend/discrete/discrete.js.map +1 -1
  45. package/es/util/label-smartInvert.js +3 -2
  46. package/es/util/label-smartInvert.js.map +1 -1
  47. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/label-smartInvert.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AAE7C,MAAM,wBAAwB,GAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAQlE,SAAgB,gBAAgB,CAC9B,qBAAyC,EACzC,qBAAyC,EACzC,QAA6B,EAC7B,uBAAgC,EAChC,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAChE,MAAM,eAAe,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAChE,IAAI,CAAC,4BAA4B,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,uBAAuB,CAAC,EAAE;QACtG,OAAO,sBAAsB,CAC3B,eAAe,EACf,eAAe,EACf,QAAQ,EACR,uBAAuB,EACvB,iBAAiB,CAClB,CAAC;KACH;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAnBD,4CAmBC;AASD,SAAS,sBAAsB,CAC7B,eAAmC,EACnC,eAAmC,EACnC,QAA6B,EAC7B,uBAAgC,EAChC,iBAAqC;IAErC,MAAM,wBAAwB,GAAa,EAAE,CAAC;IAC9C,IAAI,iBAAiB,EAAE;QACrB,IAAI,iBAAiB,YAAY,KAAK,EAAE;YACtC,wBAAwB,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAC;SACrD;aAAM;YACL,wBAAwB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;SAClD;KACF;IACD,wBAAwB,CAAC,IAAI,CAAC,GAAG,wBAAwB,CAAC,CAAC;IAC3D,KAAK,MAAM,gBAAgB,IAAI,wBAAwB,EAAE;QACvD,IAAI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AC,GAAG,CAAC,EAAE;QAC1C,OAAO,WAAW,CAAC;KACpB;IACD,MAAM,CAAC,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,WAAqB,CAAC,CAAC;IACrD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5B,OAAO,GAAG,GAAG,kBAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,mBAAmB,CACjC,YAAoB,EACpB,SAAiB,EACjB,WAAmB,EACnB,YAAoB;IAEpB,IAAI,MAAM,CAAC;IACX,QAAQ,YAAY,EAAE;QACpB,KAAK,MAAM;YACT,MAAM,GAAG,SAAS,CAAC;YACnB,MAAM;QACR,KAAK,YAAY;YACf,MAAM,GAAG,WAAW,CAAC;YACrB,MAAM;QACR,KAAK,aAAa;YAChB,MAAM,GAAG,YAAY,CAAC;QACxB;YACE,MAAM;KACT;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,kDAoBC","file":"label-smartInvert.js","sourcesContent":["import type { IColor } from '@visactor/vrender';\nimport { ColorUtil } from '@visactor/vutils';\n\nconst defaultAlternativeColors: string[] = ['#ffffff', '#000000'];\n\n/**\n * 标签智能反色\n * @param foregroundColorOrigin\n * @param backgroundColorOrogin\n * @returns\n */\nexport function labelSmartInvert(\n foregroundColorOrigin: IColor | undefined,\n backgroundColorOrogin: IColor | undefined,\n textType?: string | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n): IColor | undefined {\n const foregroundColor = formatColorToHex(foregroundColorOrigin);\n const backgroundColor = formatColorToHex(backgroundColorOrogin);\n if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return improveContrastReverse(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n }\n return foregroundColor;\n}\n\n/**\n * 提升对比度\n * 对于对比度不足阈值的情况,推荐备选颜色色板中的颜色提升对比\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction improveContrastReverse(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n) {\n const alternativeColorPalletes: string[] = [];\n if (alternativeColors) {\n if (alternativeColors instanceof Array) {\n alternativeColorPalletes.push(...alternativeColors);\n } else {\n alternativeColorPalletes.push(alternativeColors);\n }\n }\n alternativeColorPalletes.push(...defaultAlternativeColors);\n for (const alternativeColor of alternativeColorPalletes) {\n if (foregroundColor === alternativeColor) {\n continue;\n }\n if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return alternativeColor;\n }\n }\n return undefined;\n}\n\n/**\n * 颜色对比度可行性检查 https://webaim.org/articles/contrast/\n * - WCAG 2.0 AA 级要求普通文本的对比度至少为 4.5:1,大文本的对比度至少为 3:1。(目前按照此标准)\n * - WCAG 2.1 要求图形和用户界面组件(例如表单输入边框)的对比度至少为 3:1。\n * - WCAG AAA 级要求普通文本的对比度至少为 7:1,大文本的对比度至少为 4.5:1。\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nexport function contrastAccessibilityChecker(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number\n): boolean {\n //Contrast ratios can range from 1 to 21\n if (contrastRatiosThreshold) {\n if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {\n return true;\n }\n return false;\n } else if (textType === 'largeText') {\n if (contrastRatios(foregroundColor, backgroundColor) > 3) {\n return true;\n }\n return false;\n }\n if (contrastRatios(foregroundColor, backgroundColor) > 4.5) {\n return true;\n }\n return false;\n}\n\n/**\n * 计算颜色对比度 https://webaim.org/articles/contrast/\n * Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).\n * (L1 + 0.05) / (L2 + 0.05), whereby:\n * L1 is the relative luminance of the lighter of the colors, and\n * L2 is the relative luminance of the darker of the colors.\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction contrastRatios(foregroundColor: IColor | undefined, backgroundColor: IColor | undefined): number {\n const foregroundColorLuminance = getColorLuminance(foregroundColor as string);\n const backgroundColorLuminance = getColorLuminance(backgroundColor as string);\n const L1 = foregroundColorLuminance > backgroundColorLuminance ? foregroundColorLuminance : backgroundColorLuminance;\n const L2 = foregroundColorLuminance > backgroundColorLuminance ? backgroundColorLuminance : foregroundColorLuminance;\n const contrastRatios = (L1 + 0.05) / (L2 + 0.05);\n return contrastRatios;\n}\n\n/**\n * 计算相对亮度 https://webaim.org/articles/contrast/\n * the relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white\n * Note 1: For the sRGB colorspace, the relative luminance of a color is defined as\n * L = 0.2126 * R + 0.7152 * G + 0.0722 * B where R, G and B are defined as:\n * if RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4\n * if GsRGB <= 0.03928 then G = GsRGB/12.92 else G = ((GsRGB+0.055)/1.055) ^ 2.4\n * if BsRGB <= 0.03928 then B = BsRGB/12.92 else B = ((BsRGB+0.055)/1.055) ^ 2.4\n * and RsRGB, GsRGB, and BsRGB are defined as:\n * RsRGB = R8bit/255\n * GsRGB = G8bit/255\n * BsRGB = B8bit/255\n * @param color\n * @returns\n */\nfunction getColorLuminance(color: string): number {\n const rgb8bit = ColorUtil.hexToRgb(color);\n const RsRGB = rgb8bit[0] / 255;\n const GsRGB = rgb8bit[1] / 255;\n const BsRGB = rgb8bit[2] / 255;\n let R;\n let G;\n let B;\n if (RsRGB <= 0.03928) {\n R = RsRGB / 12.92;\n } else {\n R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n }\n if (GsRGB <= 0.03928) {\n G = GsRGB / 12.92;\n } else {\n G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n }\n if (BsRGB <= 0.03928) {\n B = BsRGB / 12.92;\n } else {\n B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n }\n const L = 0.2126 * R + 0.7152 * G + 0.0722 * B;\n return L;\n}\n\n/**\n * 规范化color格式为hex\n * 当color为颜色名称或rgb时,对其进行规范化处理\n * @param originColor\n * @returns\n */\nfunction formatColorToHex(originColor: IColor | undefined) {\n if ((originColor as string)?.includes('#')) {\n return originColor;\n }\n const c = new ColorUtil.Color(originColor as string);\n const { r, g, b } = c.color;\n return '#' + ColorUtil.rgbToHex(r, g, b);\n}\n\nexport function smartInvertStrategy(\n fillStrategy: string,\n baseColor: IColor,\n invertColor: IColor,\n similarColor: IColor\n) {\n let result;\n switch (fillStrategy) {\n case 'base':\n result = baseColor;\n break;\n case 'invertBase':\n result = invertColor;\n break;\n case 'similarBase':\n result = similarColor;\n default:\n break;\n }\n return result;\n}\n"]}
1
+ {"version":3,"sources":["../src/util/label-smartInvert.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AAE7C,MAAM,wBAAwB,GAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAClE,MAAM,EAAE,KAAK,EAAE,GAAG,kBAAS,CAAC;AAQ5B,SAAgB,gBAAgB,CAC9B,qBAAyC,EACzC,qBAAyC,EACzC,QAA6B,EAC7B,uBAAgC,EAChC,iBAAqC;IAErC,IAAI,OAAO,qBAAqB,KAAK,QAAQ,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE;QAC1F,OAAO,qBAAqB,CAAC;KAC9B;IACD,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,qBAA+B,CAAC,CAAC,KAAK,EAAE,CAAC;IAC3E,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,qBAA+B,CAAC,CAAC,KAAK,EAAE,CAAC;IAC3E,IAAI,CAAC,4BAA4B,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,uBAAuB,CAAC,EAAE;QACtG,OAAO,sBAAsB,CAC3B,eAAe,EAC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BC","file":"label-smartInvert.js","sourcesContent":["import type { IColor } from '@visactor/vrender';\nimport { ColorUtil } from '@visactor/vutils';\n\nconst defaultAlternativeColors: string[] = ['#ffffff', '#000000'];\nconst { Color } = ColorUtil;\n\n/**\n * 标签智能反色\n * @param foregroundColorOrigin\n * @param backgroundColorOrogin\n * @returns\n */\nexport function labelSmartInvert(\n foregroundColorOrigin: IColor | undefined,\n backgroundColorOrogin: IColor | undefined,\n textType?: string | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n): IColor | undefined {\n if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {\n return foregroundColorOrigin;\n }\n const foregroundColor = new Color(foregroundColorOrigin as string).toHex();\n const backgroundColor = new Color(backgroundColorOrogin as string).toHex();\n if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return improveContrastReverse(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n }\n return foregroundColor;\n}\n\n/**\n * 提升对比度\n * 对于对比度不足阈值的情况,推荐备选颜色色板中的颜色提升对比\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction improveContrastReverse(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n) {\n const alternativeColorPalletes: string[] = [];\n if (alternativeColors) {\n if (alternativeColors instanceof Array) {\n alternativeColorPalletes.push(...alternativeColors);\n } else {\n alternativeColorPalletes.push(alternativeColors);\n }\n }\n alternativeColorPalletes.push(...defaultAlternativeColors);\n for (const alternativeColor of alternativeColorPalletes) {\n if (foregroundColor === alternativeColor) {\n continue;\n }\n if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return alternativeColor;\n }\n }\n return undefined;\n}\n\n/**\n * 颜色对比度可行性检查 https://webaim.org/articles/contrast/\n * - WCAG 2.0 AA 级要求普通文本的对比度至少为 4.5:1,大文本的对比度至少为 3:1。(目前按照此标准)\n * - WCAG 2.1 要求图形和用户界面组件(例如表单输入边框)的对比度至少为 3:1。\n * - WCAG AAA 级要求普通文本的对比度至少为 7:1,大文本的对比度至少为 4.5:1。\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nexport function contrastAccessibilityChecker(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number\n): boolean {\n //Contrast ratios can range from 1 to 21\n if (contrastRatiosThreshold) {\n if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {\n return true;\n }\n return false;\n } else if (textType === 'largeText') {\n if (contrastRatios(foregroundColor, backgroundColor) > 3) {\n return true;\n }\n return false;\n }\n if (contrastRatios(foregroundColor, backgroundColor) > 4.5) {\n return true;\n }\n return false;\n}\n\n/**\n * 计算颜色对比度 https://webaim.org/articles/contrast/\n * Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).\n * (L1 + 0.05) / (L2 + 0.05), whereby:\n * L1 is the relative luminance of the lighter of the colors, and\n * L2 is the relative luminance of the darker of the colors.\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction contrastRatios(foregroundColor: IColor | undefined, backgroundColor: IColor | undefined): number {\n const foregroundColorLuminance = getColorLuminance(foregroundColor as string);\n const backgroundColorLuminance = getColorLuminance(backgroundColor as string);\n const L1 = foregroundColorLuminance > backgroundColorLuminance ? foregroundColorLuminance : backgroundColorLuminance;\n const L2 = foregroundColorLuminance > backgroundColorLuminance ? backgroundColorLuminance : foregroundColorLuminance;\n const contrastRatios = (L1 + 0.05) / (L2 + 0.05);\n return contrastRatios;\n}\n\n/**\n * 计算相对亮度 https://webaim.org/articles/contrast/\n * the relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white\n * Note 1: For the sRGB colorspace, the relative luminance of a color is defined as\n * L = 0.2126 * R + 0.7152 * G + 0.0722 * B where R, G and B are defined as:\n * if RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4\n * if GsRGB <= 0.03928 then G = GsRGB/12.92 else G = ((GsRGB+0.055)/1.055) ^ 2.4\n * if BsRGB <= 0.03928 then B = BsRGB/12.92 else B = ((BsRGB+0.055)/1.055) ^ 2.4\n * and RsRGB, GsRGB, and BsRGB are defined as:\n * RsRGB = R8bit/255\n * GsRGB = G8bit/255\n * BsRGB = B8bit/255\n * @param color\n * @returns\n */\nfunction getColorLuminance(color: string): number {\n const rgb8bit = ColorUtil.hexToRgb(color);\n const RsRGB = rgb8bit[0] / 255;\n const GsRGB = rgb8bit[1] / 255;\n const BsRGB = rgb8bit[2] / 255;\n let R;\n let G;\n let B;\n if (RsRGB <= 0.03928) {\n R = RsRGB / 12.92;\n } else {\n R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n }\n if (GsRGB <= 0.03928) {\n G = GsRGB / 12.92;\n } else {\n G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n }\n if (BsRGB <= 0.03928) {\n B = BsRGB / 12.92;\n } else {\n B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n }\n const L = 0.2126 * R + 0.7152 * G + 0.0722 * B;\n return L;\n}\n\n/**\n * 规范化color格式为hex\n * 当color为颜色名称或rgb时,对其进行规范化处理\n * @param originColor\n * @returns\n */\nfunction formatColorToHex(originColor: IColor | undefined) {\n if ((originColor as string)?.includes('#')) {\n return originColor;\n }\n const c = new ColorUtil.Color(originColor as string);\n const { r, g, b } = c.color;\n return '#' + ColorUtil.rgbToHex(r, g, b);\n}\n\nexport function smartInvertStrategy(\n fillStrategy: string,\n baseColor: IColor,\n invertColor: IColor,\n similarColor: IColor\n) {\n let result;\n switch (fillStrategy) {\n case 'base':\n result = baseColor;\n break;\n case 'invertBase':\n result = invertColor;\n break;\n case 'similarBase':\n result = similarColor;\n default:\n break;\n }\n return result;\n}\n"]}
package/dist/index.js CHANGED
@@ -403,9 +403,13 @@
403
403
  }
404
404
 
405
405
  const defaultAlternativeColors = ['#ffffff', '#000000'];
406
+ const { Color } = vutils.ColorUtil;
406
407
  function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors) {
407
- const foregroundColor = formatColorToHex(foregroundColorOrigin);
408
- const backgroundColor = formatColorToHex(backgroundColorOrogin);
408
+ if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {
409
+ return foregroundColorOrigin;
410
+ }
411
+ const foregroundColor = new Color(foregroundColorOrigin).toHex();
412
+ const backgroundColor = new Color(backgroundColorOrogin).toHex();
409
413
  if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {
410
414
  return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
411
415
  }
@@ -487,14 +491,6 @@
487
491
  const L = 0.2126 * R + 0.7152 * G + 0.0722 * B;
488
492
  return L;
489
493
  }
490
- function formatColorToHex(originColor) {
491
- if (originColor === null || originColor === void 0 ? void 0 : originColor.includes('#')) {
492
- return originColor;
493
- }
494
- const c = new vutils.ColorUtil.Color(originColor);
495
- const { r, g, b } = c.color;
496
- return '#' + vutils.ColorUtil.rgbToHex(r, g, b);
497
- }
498
494
  function smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor) {
499
495
  let result;
500
496
  switch (fillStrategy) {
@@ -2032,13 +2028,14 @@
2032
2028
  return listener;
2033
2029
  }
2034
2030
  _smartInvert(labels) {
2035
- var _a, _b, _c, _d;
2031
+ var _a, _b, _c, _d, _e;
2036
2032
  const option = (this.attribute.smartInvert || {});
2037
2033
  const { textType, contrastRatiosThreshold, alternativeColors } = option;
2038
2034
  const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertBase';
2039
2035
  const strokeStrategy = (_b = option.strokeStrategy) !== null && _b !== void 0 ? _b : 'base';
2040
2036
  const brightColor = (_c = option.brightColor) !== null && _c !== void 0 ? _c : '#ffffff';
2041
2037
  const darkColor = (_d = option.darkColor) !== null && _d !== void 0 ? _d : '#000000';
2038
+ const outsideEnable = (_e = option.outsideEnable) !== null && _e !== void 0 ? _e : false;
2042
2039
  if (fillStrategy === 'null' && strokeStrategy === 'null') {
2043
2040
  return;
2044
2041
  }
@@ -2048,13 +2045,12 @@
2048
2045
  continue;
2049
2046
  }
2050
2047
  const baseMark = this._idToGraphic.get(label.attribute.id);
2051
- const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
2052
2048
  const backgroundColor = baseMark.attribute.fill;
2053
2049
  const foregroundColor = label.attribute.fill;
2054
2050
  const baseColor = backgroundColor;
2055
2051
  const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
2056
2052
  const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
2057
- if (isInside) {
2053
+ if (outsideEnable) {
2058
2054
  const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2059
2055
  fill && label.setAttributes({ fill });
2060
2056
  if (label.attribute.lineWidth === 0) {
@@ -2064,19 +2060,31 @@
2064
2060
  stroke && label.setAttributes({ stroke });
2065
2061
  }
2066
2062
  else {
2067
- if (label.attribute.lineWidth === 0) {
2068
- continue;
2063
+ const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
2064
+ if (isInside) {
2065
+ const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2066
+ fill && label.setAttributes({ fill });
2067
+ if (label.attribute.lineWidth === 0) {
2068
+ continue;
2069
+ }
2070
+ const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2071
+ stroke && label.setAttributes({ stroke });
2069
2072
  }
2070
- if (label.attribute.stroke) {
2071
- label.setAttributes({
2072
- fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
2073
- });
2074
- continue;
2073
+ else {
2074
+ if (label.attribute.lineWidth === 0) {
2075
+ continue;
2076
+ }
2077
+ if (label.attribute.stroke) {
2078
+ label.setAttributes({
2079
+ fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
2080
+ });
2081
+ continue;
2082
+ }
2083
+ const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2084
+ fill && label.setAttributes({ fill });
2085
+ const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2086
+ stroke && label.setAttributes({ stroke });
2075
2087
  }
2076
- const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2077
- fill && label.setAttributes({ fill });
2078
- const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2079
- stroke && label.setAttributes({ stroke });
2080
2088
  }
2081
2089
  }
2082
2090
  }
@@ -5526,6 +5534,7 @@
5526
5534
  end: this.state.end
5527
5535
  });
5528
5536
  this._updateStateCallback && this._updateStateCallback(this.state.start, this.state.end);
5537
+ this._dispatchChangeEvent(this.state.start, this.state.end);
5529
5538
  }
5530
5539
  };
5531
5540
  const { start, end, size, orient, showDetail, position, previewData, previewCallbackX, previewCallbackY, previewCallbackX1, previewCallbackY1, updateStateCallback } = this.attribute;
@@ -5625,6 +5634,7 @@
5625
5634
  end: this.state.end
5626
5635
  });
5627
5636
  this._updateStateCallback && this._updateStateCallback(this.state.start, this.state.end);
5637
+ this._dispatchChangeEvent(this.state.start, this.state.end);
5628
5638
  }
5629
5639
  }
5630
5640
  _onHandlerPointerEnter(e) {
@@ -5984,6 +5994,15 @@
5984
5994
  container.add(labelShape);
5985
5995
  return labelShape;
5986
5996
  }
5997
+ _dispatchChangeEvent(start, end) {
5998
+ var _a;
5999
+ const changeEvent = new vrender.CustomEvent('change', {
6000
+ start,
6001
+ end
6002
+ });
6003
+ changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
6004
+ this.dispatchEvent(changeEvent);
6005
+ }
5987
6006
  setStartAndEnd(start, end) {
5988
6007
  const { start: startAttr, end: endAttr } = this.attribute;
5989
6008
  if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
@@ -5992,6 +6011,7 @@
5992
6011
  if (startAttr !== this.state.start || endAttr !== this.state.end) {
5993
6012
  this.setAttributes({ start, end });
5994
6013
  this._updateStateCallback && this._updateStateCallback(start, end);
6014
+ this._dispatchChangeEvent(start, end);
5995
6015
  }
5996
6016
  }
5997
6017
  }
@@ -7627,7 +7647,7 @@
7627
7647
  opacity: 0.85
7628
7648
  },
7629
7649
  unSelected: {
7630
- fill: '#D8D8D8'
7650
+ opacity: 0.5
7631
7651
  }
7632
7652
  }
7633
7653
  },
@@ -9784,6 +9804,11 @@
9784
9804
  })(exports.IOperateType || (exports.IOperateType = {}));
9785
9805
 
9786
9806
  const DEFAULT_BRUSH_ATTRIBUTES = {
9807
+ trigger: 'pointerdown',
9808
+ updateTrigger: 'pointermove',
9809
+ endTrigger: 'pointerup',
9810
+ resetTrigger: 'pointerupoutside',
9811
+ hasMask: true,
9787
9812
  brushMode: 'single',
9788
9813
  brushType: 'rect',
9789
9814
  brushStyle: {
@@ -9845,6 +9870,7 @@
9845
9870
  const { removeOnClick = true } = this.attribute;
9846
9871
  if (this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick) {
9847
9872
  this._container.incrementalClearChild();
9873
+ this._brushMaskAABBBoundsDict = {};
9848
9874
  this._updateDragMaskCallback &&
9849
9875
  this._updateDragMaskCallback({
9850
9876
  operateType: exports.IOperateType.brushClear,
@@ -9867,11 +9893,11 @@
9867
9893
  };
9868
9894
  }
9869
9895
  bindBrushEvents() {
9870
- const { delayType = 'throttle', delayTime = 0 } = this.attribute;
9871
- this.stage.addEventListener('pointerdown', this._onBrushStart);
9872
- this.stage.addEventListener('pointermove', delayMap[delayType](this._onBrushing, delayTime));
9873
- this.stage.addEventListener('pointerup', this._onBrushEnd);
9874
- this.stage.addEventListener('pointerupoutside', this._onBrushEnd);
9896
+ const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
9897
+ this.stage.addEventListener(trigger, this._onBrushStart);
9898
+ this.stage.addEventListener(updateTrigger, delayMap[delayType](this._onBrushing, delayTime));
9899
+ this.stage.addEventListener(endTrigger, this._onBrushEnd);
9900
+ this.stage.addEventListener(resetTrigger, this._onBrushEnd);
9875
9901
  }
9876
9902
  _isPosInBrushMask(e) {
9877
9903
  const pos = this.eventPosToStagePos(e);
@@ -9897,6 +9923,7 @@
9897
9923
  this._cacheDrawPoints = [pos];
9898
9924
  this._isDrawedBeforeEnd = false;
9899
9925
  if (brushMode === 'single') {
9926
+ this._brushMaskAABBBoundsDict = {};
9900
9927
  this._container.incrementalClearChild();
9901
9928
  }
9902
9929
  this._addBrushMask();
@@ -9933,15 +9960,21 @@
9933
9960
  var _a;
9934
9961
  const pos = this.eventPosToStagePos(e);
9935
9962
  const { x1 = 0, x2 = 0, y1 = 0, y2 = 0 } = (_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a._AABBBounds;
9936
- const { sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute;
9963
+ const { sizeThreshold = DEFAULT_SIZE_THRESHOLD, brushType } = this.attribute;
9964
+ const cacheLength = this._cacheDrawPoints.length;
9937
9965
  this._isDrawedBeforeEnd = !!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold);
9938
- if (this._cacheDrawPoints.length > 0) {
9966
+ if (cacheLength > 0) {
9939
9967
  const lastPos = this._cacheDrawPoints[this._cacheDrawPoints.length - 1];
9940
9968
  if (pos.x === (lastPos === null || lastPos === void 0 ? void 0 : lastPos.x) && pos.y === (lastPos === null || lastPos === void 0 ? void 0 : lastPos.y)) {
9941
9969
  return;
9942
9970
  }
9943
9971
  }
9944
- this._cacheDrawPoints.push(pos);
9972
+ if (brushType === 'polygon' || cacheLength <= 1) {
9973
+ this._cacheDrawPoints.push(pos);
9974
+ }
9975
+ else {
9976
+ this._cacheDrawPoints[cacheLength - 1] = pos;
9977
+ }
9945
9978
  const maskPoints = this._computeMaskPoints();
9946
9979
  this._operatingMask.setAttribute('points', maskPoints);
9947
9980
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
@@ -10041,8 +10074,9 @@
10041
10074
  return maskPoints;
10042
10075
  }
10043
10076
  _addBrushMask() {
10044
- const { brushStyle } = this.attribute;
10045
- const brushMask = vrender.createPolygon(Object.assign({ points: vutils.cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle));
10077
+ var _a;
10078
+ const { brushStyle, hasMask } = this.attribute;
10079
+ const brushMask = vrender.createPolygon(Object.assign(Object.assign({ points: vutils.cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? (_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1 : 0 }));
10046
10080
  brushMask.name = `brush-${Date.now()}`;
10047
10081
  this._operatingMask = brushMask;
10048
10082
  this._container.add(brushMask);
@@ -10074,11 +10108,11 @@
10074
10108
  vutils.isFunction(callback) && (this._updateDragMaskCallback = callback);
10075
10109
  }
10076
10110
  releaseBrushEvents() {
10077
- const { delayType = 'throttle', delayTime = 0 } = this.attribute;
10078
- this.stage.removeEventListener('pointerdown', this._onBrushStart);
10079
- this.stage.removeEventListener('pointermove', delayMap[delayType](this._onBrushing, delayTime));
10080
- this.stage.removeEventListener('pointerup', this._onBrushEnd);
10081
- this.stage.removeEventListener('pointerupoutside', this._onBrushEnd);
10111
+ const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
10112
+ this.stage.removeEventListener(trigger, this._onBrushStart);
10113
+ this.stage.removeEventListener(updateTrigger, delayMap[delayType](this._onBrushing, delayTime));
10114
+ this.stage.removeEventListener(endTrigger, this._onBrushEnd);
10115
+ this.stage.removeEventListener(resetTrigger, this._onBrushEnd);
10082
10116
  }
10083
10117
  }
10084
10118
  Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
@@ -10469,7 +10503,7 @@
10469
10503
  return new Tag(params ? params.attribute : {});
10470
10504
  }
10471
10505
 
10472
- const version = "0.15.3-alpha.9";
10506
+ const version = "0.15.4";
10473
10507
 
10474
10508
  exports.AbstractComponent = AbstractComponent;
10475
10509
  exports.ArcInfo = ArcInfo;