Commit 8f7e1eb3 authored by 李纪文's avatar 李纪文

feat: 云台控制

parent fa7e03e0
...@@ -12,6 +12,7 @@ class App extends React.Component { ...@@ -12,6 +12,7 @@ class App extends React.Component {
this.showOperateBtns = true; this.showOperateBtns = true;
this.$container = null; this.$container = null;
this.forceNoOffscreen = false; this.forceNoOffscreen = false;
this.domRef = React.createRef();
this.state = { this.state = {
isPlaying: false, isPlaying: false,
...@@ -130,17 +131,20 @@ class App extends React.Component { ...@@ -130,17 +131,20 @@ class App extends React.Component {
} }
appendControl() { appendControl() {
const parentElement = document.getElementsByClassName("jessibuca-controls-right")[0]; try {
const childElement = document.createElement("div"); if(!this.domRef.current || this.domRef.current.getElementsByClassName('jessibuca-control').length) return false;
childElement.className = 'jessibuca-control'; const parentElement = this.domRef.current.getElementsByClassName("jessibuca-controls-right")[0];
const childChildElement = document.createElement("i"); const childElement = document.createElement("div");
childElement.addEventListener("click", () => { childElement.className = 'jessibuca-control';
// 点击 childElement 时触发的代码 const childChildElement = document.createElement("i");
this.setState({ isShowControl: !this.state.isShowControl }); childElement.addEventListener("click", () => {
}); // 点击 childElement 时触发的代码
// 将子元素添加到子元素的子元素中 this.setState({ isShowControl: !this.state.isShowControl });
parentElement.insertBefore(childElement, parentElement.firstChild); });
childElement.appendChild(childChildElement); // 将子元素添加到子元素的子元素中
parentElement.insertBefore(childElement, parentElement.firstChild);
childElement.appendChild(childChildElement);
} catch (err) {}
} }
closeCloudPlate() { closeCloudPlate() {
...@@ -162,7 +166,7 @@ class App extends React.Component { ...@@ -162,7 +166,7 @@ class App extends React.Component {
); );
} }
render() { render() {
return <div className={style.root}>{this.renderCheckedArr()}</div>; return <div className={style.root} ref={this.domRef}>{this.renderCheckedArr()}</div>;
} }
} }
......
.cloud-plate { .cloud-plate {
position: absolute; position: absolute;
bottom: 38px; bottom: 43px;
right: 0; right: 5px;
width: 278px; width: 278px;
height: 165px; height: 165px;
border-radius: 5px 0px 0px; border-radius: 5px 0px 0px;
background: rgba(0, 0, 0, 0.75); background: #000000bf;
display: flex; display: flex;
.cloud-right { .cloud-right {
...@@ -194,10 +194,10 @@ ...@@ -194,10 +194,10 @@
.close-wrapper { .close-wrapper {
position: absolute; position: absolute;
right: 10px; right: 5px;
top: 8px; top: 5px;
width: 21px; width: 18px;
height: 21px; height: 18px;
border-radius: 50%; border-radius: 50%;
background: #474a4c; background: #474a4c;
display: flex; display: flex;
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
:global { :global {
.anticon-close { .anticon-close {
font-size: 14px; font-size: 12px;
color: #000000; color: #000000;
opacity: 0.6; opacity: 0.6;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment