MCPcopy Create free account
hub / github.com/bwasti/mebm / scrubMove

Method scrubMove

script.js:952–987  ·  view source on GitHub ↗
(ev)

Source from the content-addressed store, hash-verified

950 }
951
952 scrubMove(ev) {
953 ev.preventDefault();
954 ev.stopPropagation();
955 let rect = this.time_canvas.getBoundingClientRect();
956 let time = ev.offsetX / rect.width * this.total_time;
957
958 document.body.style.cursor = "default";
959
960 if (this.selected_layer) {
961 let l = this.selected_layer;
962 if (this.intersectsTime(l.start_time, time)) {
963 document.body.style.cursor = "col-resize";
964 }
965 if (this.intersectsTime(l.start_time + l.total_time, time)) {
966 document.body.style.cursor = "col-resize";
967 }
968 }
969
970 this.cursor_preview.style.display = "block";
971 let cursor_x = Math.max(ev.clientX - this.cursor_canvas.clientWidth / 2, 0);
972 cursor_x = Math.min(cursor_x, rect.width - this.cursor_canvas.clientWidth);
973 this.cursor_preview.style.left = cursor_x + "px";
974 this.cursor_preview.style.bottom = (rect.height) + "px";
975
976 this.aux_time = time;
977 this.cursor_text.textContent = this.aux_time.toFixed(2) + "/" + this.total_time.toFixed(2)
978
979
980 if (this.scrubbing) {
981 this.time = time;
982 }
983
984 if (this.dragging) {
985 this.dragging(this.time);
986 }
987 }
988
989 scrubEnd(ev) {
990 document.body.style.cursor = "default";

Callers

nothing calls this directly

Calls 1

intersectsTimeMethod · 0.95

Tested by

no test coverage detected