inactive cursors ignore own cursor.

This commit is contained in:
Miroslav Šedivý 2021-10-26 22:55:22 +02:00
parent 0480a0d512
commit cd8d0da96a
2 changed files with 12 additions and 1 deletions

View File

@ -28,6 +28,9 @@
@Ref('overlay') readonly _overlay!: HTMLCanvasElement @Ref('overlay') readonly _overlay!: HTMLCanvasElement
private _ctx!: CanvasRenderingContext2D private _ctx!: CanvasRenderingContext2D
@Prop()
private readonly sessionId!: string
@Prop() @Prop()
private readonly screenSize!: Dimension private readonly screenSize!: Dimension
@ -90,6 +93,9 @@
// draw cursors // draw cursors
for (let { id, x, y } of this.cursors) { for (let { id, x, y } of this.cursors) {
// ignore own cursor
if (id == this.sessionId) continue
// get cursor position // get cursor position
x = Math.round((x / this.screenSize.width) * width) x = Math.round((x / this.screenSize.width) * width)
y = Math.round((y / this.screenSize.height) * height) y = Math.round((y / this.screenSize.height) * height)

View File

@ -3,7 +3,12 @@
<div ref="container" class="neko-container"> <div ref="container" class="neko-container">
<video v-show="!screencast" ref="video" :autoplay="autoplay" :muted="autoplay" playsinline /> <video v-show="!screencast" ref="video" :autoplay="autoplay" :muted="autoplay" playsinline />
<neko-screencast v-show="screencast" :enabled="screencast" :api="api.room" /> <neko-screencast v-show="screencast" :enabled="screencast" :api="api.room" />
<neko-cursors :screenSize="state.screen.size" :canvasSize="canvasSize" :cursors="state.cursors" /> <neko-cursors
:sessionId="state.session_id"
:screenSize="state.screen.size"
:canvasSize="canvasSize"
:cursors="state.cursors"
/>
<neko-overlay <neko-overlay
:webrtc="connection.webrtc" :webrtc="connection.webrtc"
:scroll="state.control.scroll" :scroll="state.control.scroll"