@tencentcloud/roomkit-electron-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
234 lines (233 loc) • 9.83 kB
JavaScript
import { defineComponent, ref, reactive, watch, withDirectives, createBlock, openBlock, withCtx, createVNode, createElementBlock, createCommentVNode, normalizeClass, createElementVNode, toDisplayString, unref, Fragment, renderList, withModifiers } from "vue";
import { DrawingTool } from "../../type.mjs";
import { useI18n } from "../../../../locales/index.mjs";
import vClickOutside from "../../../../directives/vClickOutside.mjs";
import IconButton from "../../../common/base/IconButton.vue.mjs";
/* empty css */
import ShapeIcon from "../Icon/ShapeIcon.vue.mjs";
import SizeSmall from "../Image/SizeSmall.svg.mjs";
import SizeMid from "../Image/SizeMid.svg.mjs";
import SizeBig from "../Image/SizeBig.svg.mjs";
import SizeLarge from "../Image/SizeLarge.svg.mjs";
import BlueIcon from "../Image/BlueIcon.svg.mjs";
import PurpleIcon from "../Image/PurpleIcon.svg.mjs";
import YellowIcon from "../Image/YellowIcon.svg.mjs";
import OrangeIcon from "../Image/OrangeIcon.svg.mjs";
import RedIcon from "../Image/RedIcon.svg.mjs";
import GreenIcon from "../Image/GreenIcon.svg.mjs";
import DeepBlueIcon from "../Image/DeepBlueIcon.svg.mjs";
import BlackIcon from "../Image/BlackIcon.svg.mjs";
import DarkGrayIcon from "../Image/DarkGrayIcon.svg.mjs";
import GrayIcon from "../Image/GrayIcon.svg.mjs";
import LightGrayIcon from "../Image/LightGrayIcon.svg.mjs";
import WhiteIcon from "../Image/WhiteIcon.svg.mjs";
import Rectangle from "../Image/ShapeRectangle.svg.mjs";
import Circle from "../Image/ShapeCircle.svg.mjs";
import Dashed from "../Image/StyleDashed.svg.mjs";
import Line from "../Image/ShapeLine.svg.mjs";
import Solid from "../Image/StyleSolid.svg.mjs";
import Triangle from "../Image/ShapeTriangle.svg.mjs";
const _hoisted_1 = {
key: 0,
class: "shape-tool-setting whiteboard-tool-setting"
};
const _hoisted_2 = { class: "type-setting-title setting-title" };
const _hoisted_3 = { class: "type-setting-section setting-section" };
const _hoisted_4 = ["onClick"];
const _hoisted_5 = ["src"];
const _hoisted_6 = { class: "style-setting-title setting-title" };
const _hoisted_7 = { class: "style-setting-section setting-section" };
const _hoisted_8 = ["onClick"];
const _hoisted_9 = ["src"];
const _hoisted_10 = { class: "size-setting-title setting-title" };
const _hoisted_11 = { class: "size-setting-section setting-section" };
const _hoisted_12 = ["onClick"];
const _hoisted_13 = ["src"];
const _hoisted_14 = { class: "color-setting-title setting-title" };
const _hoisted_15 = { class: "color-setting-section setting-section" };
const _hoisted_16 = ["onClick"];
const _hoisted_17 = ["src"];
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
activeTool: String
},
emits: ["click"],
setup(__props, { emit: __emit }) {
const { t } = useI18n();
const shapeTypes = [
{ icon: Line, shape: DrawingTool.Line },
{ icon: Circle, shape: DrawingTool.Circle },
{ icon: Rectangle, shape: DrawingTool.Rectangle },
{ icon: Triangle, shape: DrawingTool.Triangle }
];
const shapeStyles = [
{ icon: Solid, style: "solid" },
{ icon: Dashed, style: "dashed" }
];
const shapeSizes = [
{ icon: SizeSmall, size: 1 },
{ icon: SizeMid, size: 2 },
{ icon: SizeBig, size: 5 },
{ icon: SizeLarge, size: 10 }
];
const shapeColors = [
{ color: "#4791FF", icon: BlueIcon },
{ color: "#5940D7", icon: PurpleIcon },
{ color: "#F5C342", icon: YellowIcon },
{ color: "#E05734", icon: OrangeIcon },
{ color: "#DC3859", icon: RedIcon },
{ color: "#1AD32C", icon: GreenIcon },
{ color: "#104683", icon: DeepBlueIcon },
{ color: "#22262E", icon: BlackIcon },
{ color: "#86909A", icon: DarkGrayIcon },
{ color: "#B5BBC3", icon: GrayIcon },
{ color: "#DBDDE2", icon: LightGrayIcon },
{ color: "#EAEEF3", icon: WhiteIcon }
];
const showSettings = ref(false);
const props = __props;
function handleHideButtonSetting() {
if (props.activeTool === "Shape") {
showSettings.value = false;
}
}
const toolSetting = reactive({
drawingTool: DrawingTool.Rectangle,
shapeOptions: {
strokeWidth: 5,
stroke: "#22262E",
fill: "transparent",
opacity: 1,
lineDash: [0, 0]
}
});
const emit = __emit;
watch(
() => props.activeTool,
() => {
showSettings.value = false;
}
);
const onClick = () => {
showSettings.value = !showSettings.value;
emit("click", toolSetting);
};
const handleTypeClick = (type) => {
if (toolSetting.drawingTool === type) {
return;
}
toolSetting.drawingTool = type;
emit("click", toolSetting);
};
const handleStyleClick = (style) => {
if ("solid" === style) {
toolSetting.shapeOptions.lineDash = [0, 0];
return;
}
toolSetting.shapeOptions.lineDash = [5, 5];
emit("click", toolSetting);
};
const handleSizeClick = (size) => {
var _a;
if (size === ((_a = toolSetting.shapeOptions) == null ? void 0 : _a.strokeWidth)) {
return;
}
toolSetting.shapeOptions.strokeWidth = size;
emit("click", toolSetting);
};
const handleColorClick = (color) => {
if (toolSetting.shapeOptions.stroke !== color) {
toolSetting.shapeOptions.stroke = color;
emit("click", toolSetting);
}
};
return (_ctx, _cache) => {
return withDirectives((openBlock(), createBlock(IconButton, {
class: "tool-button",
onClickIcon: onClick
}, {
default: withCtx(() => [
createVNode(ShapeIcon, {
class: normalizeClass({ "whiteboard-icon-active": __props.activeTool === "Shape" })
}, null, 8, ["class"]),
showSettings.value && __props.activeTool === "Shape" ? (openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, toDisplayString(unref(t)("Shape Type")), 1),
createElementVNode("div", _hoisted_3, [
(openBlock(), createElementBlock(Fragment, null, renderList(shapeTypes, (shapeType) => {
return createElementVNode("button", {
key: shapeType.shape,
class: normalizeClass(["type-button setting-option-button", {
"button-active": shapeType.shape === toolSetting.drawingTool
}]),
onClick: withModifiers(($event) => handleTypeClick(shapeType.shape), ["stop"])
}, [
createElementVNode("img", {
src: shapeType.icon
}, null, 8, _hoisted_5)
], 10, _hoisted_4);
}), 64))
]),
createElementVNode("div", _hoisted_6, toDisplayString(unref(t)("Shape Style")), 1),
createElementVNode("div", _hoisted_7, [
(openBlock(), createElementBlock(Fragment, null, renderList(shapeStyles, (shapeStyle) => {
return createElementVNode("button", {
key: shapeStyle.style,
class: normalizeClass(["style-button setting-option-button", {
"button-active": toolSetting.shapeOptions.lineDash[1] === 5 ? shapeStyle.style === "dashed" : shapeStyle.style === "solid"
}]),
onClick: withModifiers(($event) => handleStyleClick(shapeStyle.style), ["stop"])
}, [
createElementVNode("img", {
src: shapeStyle.icon
}, null, 8, _hoisted_9)
], 10, _hoisted_8);
}), 64))
]),
createElementVNode("div", _hoisted_10, toDisplayString(unref(t)("Shape Size")), 1),
createElementVNode("div", _hoisted_11, [
(openBlock(), createElementBlock(Fragment, null, renderList(shapeSizes, (shapeSize) => {
var _a;
return createElementVNode("button", {
key: shapeSize.size,
class: normalizeClass(["size-button setting-option-button", {
"button-active": shapeSize.size === ((_a = toolSetting.shapeOptions) == null ? void 0 : _a.strokeWidth)
}]),
onClick: withModifiers(($event) => handleSizeClick(shapeSize.size), ["stop"])
}, [
createElementVNode("img", {
src: shapeSize.icon
}, null, 8, _hoisted_13)
], 10, _hoisted_12);
}), 64))
]),
createElementVNode("div", _hoisted_14, toDisplayString(unref(t)("Shape Color")), 1),
createElementVNode("div", _hoisted_15, [
(openBlock(), createElementBlock(Fragment, null, renderList(shapeColors, (shapeColor) => {
var _a;
return createElementVNode("button", {
key: shapeColor.color,
class: normalizeClass(["color-button setting-option-button", {
"button-active": shapeColor.color === ((_a = toolSetting.shapeOptions) == null ? void 0 : _a.stroke)
}]),
onClick: withModifiers(($event) => handleColorClick(shapeColor.color), ["stop"])
}, [
createElementVNode("img", {
src: shapeColor.icon,
alt: "Color Icon"
}, null, 8, _hoisted_17)
], 10, _hoisted_16);
}), 64))
])
])) : createCommentVNode("", true)
]),
_: 1
})), [
[unref(vClickOutside), handleHideButtonSetting]
]);
};
}
});
export {
_sfc_main as default
};