"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js");
const chartEditStore = require("../../../../../store/modules/chartEditStore/chartEditStore.js");
const designStore = require("../../../../../store/modules/designStore/designStore.js");
const useStyle_hook = require("../../hooks/useStyle.hook.js");
const designSetting = require("../../../../../settings/designSetting.js");
const runtimeCore_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js");
const runtimeDom_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_runtime-dom@3.3.4/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js");
const reactivity_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js");
const shared_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_shared@3.3.4/node_modules/@vue/shared/dist/shared.esm-bundler.js");
const _withScopeId = (n) => (runtimeCore_esmBundler.pushScopeId("data-v-fd03a995"), n = n(), runtimeCore_esmBundler.popScopeId(), n);
const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ runtimeCore_esmBundler.createElementVNode("div", { class: "select-background" }, null, -1));
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ runtimeCore_esmBundler.createElementVNode("div", { class: "select-border" }, null, -1));
const _hoisted_3 = [
  _hoisted_1,
  _hoisted_2
];
const _sfc_main = /* @__PURE__ */ runtimeCore_esmBundler.defineComponent({
  __name: "index",
  setup(__props) {
    runtimeDom_esmBundler.useCssVars((_ctx) => ({
      "3a6a09b6": themeColor.value
    }));
    const designStore$1 = designStore.useDesignStore();
    const chartEditStore$1 = chartEditStore.useChartEditStore();
    const { isSelect, scale } = reactivity_esmBundler.toRefs(chartEditStore$1.getEditCanvas);
    const themeColor = runtimeCore_esmBundler.computed(() => {
      return designStore$1.getAppTheme;
    });
    const positionStyle = reactivity_esmBundler.ref();
    runtimeCore_esmBundler.watch(
      () => chartEditStore$1.getMousePosition,
      (positionInfo) => {
        if (!isSelect.value)
          return;
        const { startX, startY, x, y } = positionInfo;
        const attr = {
          zIndex: designSetting.selectBoxIndex,
          // left
          x: 0,
          // top
          y: 0,
          // 宽
          w: 0,
          // 高
          h: 0,
          // 偏移
          offsetX: 0,
          offsetY: 0
        };
        if (x > startX && y > startY) {
          attr.x = startX;
          attr.y = startY;
          attr.w = Math.round((x - startX) / scale.value);
          attr.h = Math.round((y - startY) / scale.value);
        } else if (x > startX && y < startY) {
          attr.x = startX;
          attr.w = Math.round((x - startX) / scale.value);
          attr.h = Math.round((startY - y) / scale.value);
          attr.y = startY - attr.h;
        } else if (x < startX && y > startY) {
          attr.y = startY;
          attr.w = Math.round((startX - x) / scale.value);
          attr.h = Math.round((y - startY) / scale.value);
          attr.x = startX - attr.w;
        } else {
          attr.w = Math.round((startX - x) / scale.value);
          attr.h = Math.round((startY - y) / scale.value);
          attr.x = startX - attr.w;
          attr.y = startY - attr.h;
        }
        positionStyle.value = {
          ...useStyle_hook.useComponentStyle(attr, designSetting.selectBoxIndex),
          ...useStyle_hook.useSizeStyle(attr)
        };
      },
      {
        deep: true
      }
    );
    return (_ctx, _cache) => {
      return reactivity_esmBundler.unref(isSelect) ? (runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createElementBlock("div", {
        key: 0,
        class: "go-edit-select",
        style: shared_esmBundler.normalizeStyle(positionStyle.value)
      }, _hoisted_3, 4)) : runtimeCore_esmBundler.createCommentVNode("", true);
    };
  }
});
exports.default = _sfc_main;
