@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,
153 lines (152 loc) • 6.31 kB
JavaScript
import { defineComponent, ref, reactive, watch, withDirectives, createBlock, openBlock, mergeProps, withCtx, createVNode, createElementBlock, createCommentVNode, normalizeClass, unref, createElementVNode, toDisplayString, Fragment, renderList, withModifiers } from "vue";
import { DrawingTool } from "../../type.mjs";
import { useI18n } from "../../../../locales/index.mjs";
import IconButton from "../../../common/base/IconButton.vue.mjs";
import vClickOutside from "../../../../directives/vClickOutside.mjs";
/* empty css */
import TextIcon from "../Icon/TextIcon.vue.mjs";
import SizeIcon1 from "../Image/H1.svg.mjs";
import SizeIcon2 from "../Image/H2.svg.mjs";
import SizeIcon3 from "../Image/H3.svg.mjs";
import SizeIcon4 from "../Image/H4.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";
const _hoisted_1 = {
key: 0,
class: "text-tool-setting whiteboard-tool-setting"
};
const _hoisted_2 = { class: "size-setting-title setting-title" };
const _hoisted_3 = { class: "size-setting-section setting-section" };
const _hoisted_4 = ["onClick"];
const _hoisted_5 = ["src"];
const _hoisted_6 = { class: "color-setting-title setting-title" };
const _hoisted_7 = { class: "color-setting-section setting-section" };
const _hoisted_8 = ["onClick"];
const _hoisted_9 = ["src"];
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
props: {
activeTool: String
},
emits: ["click"],
setup(__props, { emit: __emit }) {
const { t } = useI18n();
const textSizes = [
{ icon: SizeIcon1, size: 32 },
{ icon: SizeIcon2, size: 24 },
{ icon: SizeIcon3, size: 18.72 },
{ icon: SizeIcon4, size: 16 }
];
const textColors = [
{ 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 === DrawingTool.Text) {
showSettings.value = false;
}
}
const toolSetting = reactive({
drawingTool: DrawingTool.Text,
shapeOptions: {
strokeWidth: 18.72,
stroke: "#22262E"
}
});
const emit = __emit;
watch(
() => props.activeTool,
() => {
showSettings.value = false;
}
);
const onClick = () => {
showSettings.value = !showSettings.value;
emit("click", toolSetting);
};
const handleSizeClick = (size) => {
if (size === toolSetting.shapeOptions.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, mergeProps({ class: "tool-button" }, _ctx.$attrs, { onClickIcon: onClick }), {
default: withCtx(() => [
createVNode(TextIcon, {
class: normalizeClass({ "whiteboard-icon-active": __props.activeTool === unref(DrawingTool).Text })
}, null, 8, ["class"]),
showSettings.value && __props.activeTool === "Text" ? (openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, toDisplayString(unref(t)("Text Size")), 1),
createElementVNode("div", _hoisted_3, [
(openBlock(), createElementBlock(Fragment, null, renderList(textSizes, (textSize) => {
return createElementVNode("button", {
key: textSize.size,
class: normalizeClass(["size-button setting-option-button", {
"button-active": textSize.size === toolSetting.shapeOptions.strokeWidth
}]),
onClick: withModifiers(($event) => handleSizeClick(textSize.size), ["stop"])
}, [
createElementVNode("img", {
src: textSize.icon
}, null, 8, _hoisted_5)
], 10, _hoisted_4);
}), 64))
]),
createElementVNode("div", _hoisted_6, toDisplayString(unref(t)("Text Color")), 1),
createElementVNode("div", _hoisted_7, [
(openBlock(), createElementBlock(Fragment, null, renderList(textColors, (textColor) => {
return createElementVNode("button", {
key: textColor.color,
class: normalizeClass(["color-button setting-option-button", {
"button-active": textColor.color === toolSetting.shapeOptions.stroke
}]),
onClick: withModifiers(($event) => handleColorClick(textColor.color), ["stop"])
}, [
createElementVNode("img", {
src: textColor.icon
}, null, 8, _hoisted_9)
], 10, _hoisted_8);
}), 64))
])
])) : createCommentVNode("", true)
]),
_: 1
}, 16)), [
[unref(vClickOutside), handleHideButtonSetting]
]);
};
}
});
export {
_sfc_main as default
};