mask2.js 2.9 KB

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