2285ae082177c4db1b868c1379fffe7fb6ff0265e723a1a677853cf2b00de5b1de05c898f75f576849e30e70cb8355856bd7cc8a59ad9c5c74a106998b21f6 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var core = require('@vueuse/core');
  5. var mask = require('./mask.js');
  6. var helper = require('./helper.js');
  7. var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
  8. var index = require('../../../hooks/use-lockscreen/index.js');
  9. const __default__ = vue.defineComponent({
  10. name: "ElTourMask",
  11. inheritAttrs: false
  12. });
  13. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  14. ...__default__,
  15. props: mask.maskProps,
  16. setup(__props) {
  17. const props = __props;
  18. const { ns } = vue.inject(helper.tourKey);
  19. const radius = vue.computed(() => {
  20. var _a, _b;
  21. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  22. });
  23. const roundInfo = vue.computed(() => {
  24. const v = radius.value;
  25. const baseInfo = `a${v},${v} 0 0 1`;
  26. return {
  27. topRight: `${baseInfo} ${v},${v}`,
  28. bottomRight: `${baseInfo} ${-v},${v}`,
  29. bottomLeft: `${baseInfo} ${-v},${-v}`,
  30. topLeft: `${baseInfo} ${v},${-v}`
  31. };
  32. });
  33. const { width: windowWidth, height: windowHeight } = core.useWindowSize();
  34. const path = vue.computed(() => {
  35. const width = windowWidth.value;
  36. const height = windowHeight.value;
  37. const info = roundInfo.value;
  38. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  39. const _radius = radius.value;
  40. return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
  41. });
  42. const maskStyle = vue.computed(() => ({
  43. position: "fixed",
  44. left: 0,
  45. right: 0,
  46. top: 0,
  47. bottom: 0,
  48. zIndex: props.zIndex,
  49. pointerEvents: props.pos && props.targetAreaClickable ? "none" : "auto"
  50. }));
  51. const pathStyle = vue.computed(() => ({
  52. fill: props.fill,
  53. pointerEvents: "auto",
  54. cursor: "auto"
  55. }));
  56. index.useLockscreen(vue.toRef(props, "visible"), {
  57. ns
  58. });
  59. return (_ctx, _cache) => {
  60. return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  61. key: 0,
  62. class: vue.unref(ns).e("mask"),
  63. style: vue.unref(maskStyle)
  64. }, _ctx.$attrs), [
  65. (vue.openBlock(), vue.createElementBlock("svg", { style: {
  66. width: "100%",
  67. height: "100%"
  68. } }, [
  69. vue.createElementVNode("path", {
  70. class: vue.normalizeClass(vue.unref(ns).e("hollow")),
  71. style: vue.normalizeStyle(vue.unref(pathStyle)),
  72. d: vue.unref(path)
  73. }, null, 14, ["d"])
  74. ]))
  75. ], 16)) : vue.createCommentVNode("v-if", true);
  76. };
  77. }
  78. });
  79. var ElTourMask = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "mask.vue"]]);
  80. exports["default"] = ElTourMask;
  81. //# sourceMappingURL=mask2.js.map