model-action 2.3.4 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -174,7 +174,7 @@ class PeerStream extends HTMLVideoElement {
174
174
  // overlayDiv.style.borderRadius = '5px';
175
175
  // overlayDiv.style.display = 'block'; // Initially hidden
176
176
  // this.parentNode.appendChild(overlayDiv)
177
- console.warn('你的浏览器版本过低!<br>推荐使用谷歌100以上版本浏览器!!')
177
+ console.warn("你的浏览器版本过低 推荐使用谷歌100以上版本浏览器")
178
178
  }
179
179
 
180
180
  // This will happen each time the node is moved, and may happen before the element"s contents have been fully parsed. may be called once your element is no longer connected
@@ -284,6 +284,8 @@ class PeerStream extends HTMLVideoElement {
284
284
  if ((now - this.lastmouseTime) > this.mouseReleaseTime * 1000) {
285
285
  msg.type = "mouseRelease"
286
286
  this.ws.send(JSON.stringify(msg));
287
+ this.mouseReleaseTime = undefined
288
+ this.dispatchEvent(new CustomEvent("mouseRelease", { detail: "" }));
287
289
  }
288
290
  }
289
291
  }
@@ -300,6 +302,10 @@ class PeerStream extends HTMLVideoElement {
300
302
  console.log("↓↓ getStatus:", msg);
301
303
  this.handleGetStatus(msg)
302
304
  }
305
+ else if(msg.type === "getUeinstance"){
306
+ console.log("↓↓ getUeinstance:", msg);
307
+ this.dispatchEvent(new CustomEvent("getUeinstance", { detail: msg }));
308
+ }
303
309
  else {
304
310
  console.warn("↓↓", msg);
305
311
  }
@@ -753,19 +759,20 @@ class PeerStream extends HTMLVideoElement {
753
759
 
754
760
  this.onmousedown = (e) => {
755
761
  this.emitMouseDown(e.button, e.offsetX, e.offsetY);
756
- // e.preventDefault();
762
+ //e.preventDefault();
757
763
  };
758
764
 
759
765
  this.onmouseup = (e) => {
760
766
  this.emitMouseUp(e.button, e.offsetX, e.offsetY);
761
- // e.preventDefault();
767
+ //e.preventDefault();
762
768
  };
763
769
 
764
770
  // When the context menu is shown then it is safest to release the button which was pressed when the event happened. This will guarantee we will get at least one mouse up corresponding to a mouse down event. Otherwise the mouse can get stuck.
765
771
  // https://github.com/facebook/react/issues/5531
766
772
  this.oncontextmenu = (e) => {
767
- this.emitMouseUp(e.button, e.offsetX, e.offsetY);
773
+ //this.emitMouseUp(e.button, e.offsetX, e.offsetY);
768
774
  e.preventDefault();
775
+ return false;
769
776
  };
770
777
 
771
778
  this.onwheel = (e) => {
@@ -906,13 +913,18 @@ class PeerStream extends HTMLVideoElement {
906
913
  data.setUint16(byteIdx, msg.charCodeAt(i), true);
907
914
  byteIdx += 2;
908
915
  }
909
- this.dc.send(data);
916
+ try{
917
+ this.dc.send(data);
918
+ }catch(error){
919
+ console.error(error.message);
920
+ }
921
+
910
922
 
911
- return new Promise(resolve => this.addEventListener(
912
- 'message',
913
- e => resolve(e.detail),
914
- { once: true }
915
- ));
923
+ // return new Promise(resolve => this.addEventListener(
924
+ // 'message',
925
+ // e => resolve(e.detail),
926
+ // { once: true }
927
+ // ));
916
928
  }
917
929
 
918
930
  normalize(x, y) {
@@ -934,6 +946,15 @@ class PeerStream extends HTMLVideoElement {
934
946
  }
935
947
 
936
948
 
949
+ getUeInstance(){
950
+ let msg={type: "getUeinstance"}
951
+ this.ws.send(JSON.stringify(msg));
952
+ }
953
+
954
+ killUe(){
955
+ let msg={type: "killUe"}
956
+ this.ws.send(JSON.stringify(msg));
957
+ }
937
958
  }
938
959
 
939
- customElements.define("peer-stream", PeerStream, { extends: "video" });
960
+ customElements.define("peer-stream", PeerStream, { extends: "video" });