This repository has been archived by the owner on May 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrp-cursor.recorder.js
2 lines (2 loc) · 2 KB
/
rp-cursor.recorder.js
1
2
/*! For license information please see rp-cursor.recorder.js.LICENSE.txt */
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react"),require("liqvid"),require("rp-recording")):"function"==typeof define&&define.amd?define(["react","liqvid","rp-recording"],r):"object"==typeof exports?exports.RPCursor=r(require("react"),require("liqvid"),require("rp-recording")):(e.RPCursor=e.RPCursor||{},e.RPCursor.CursorRecorderPlugin=r(e.React,e.Liqvid,e.RPRecording))}(self,(function(e,r,t){return(()=>{"use strict";var o={995:e=>{e.exports=r},359:r=>{r.exports=e},687:e=>{e.exports=t}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,i),t.exports}i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var a={};return(()=>{i.d(a,{default:()=>s});var e=i(359),r=i(995),t=i(687);const{bind:o}=r.Utils.misc;class n extends t.ReplayDataRecorder{constructor(){super(),o(this,["captureMouse"])}beginRecording(){super.beginRecording(),document.body.addEventListener("mousemove",this.captureMouse)}endRecording(){document.body.removeEventListener("mousemove",this.captureMouse)}captureMouse(e){const r=this.manager.getTime();if(this.manager.paused)return;const{left:t,top:o,height:n,width:i}=this.player.canvas.getBoundingClientRect();this.capture(r,[u((e.pageX-t)/i*100),u((e.pageY-o)/n*100)])}}const s={icon:e.createElement("g",null,e.createElement("line",{x1:"0",x2:"100",y1:"50",y2:"50",stroke:"#FFF"}),e.createElement("line",{x1:"50",x2:"50",y1:"0",y2:"100",stroke:"#FFF"})),key:"rp-cursor",name:"Cursor",recorder:new n,saveComponent:function(r){return e.createElement(e.Fragment,null,r.data?e.createElement("textarea",{readOnly:!0,value:JSON.stringify(r.data)}):"Cursor data not yet available.")},title:"Record cursor"};function u(e){return parseFloat(e.toFixed(3))}})(),a=a.default})()}));