MCPcopy Index your code
hub / github.com/nodejs/node / onMouseUp

Method onMouseUp

deps/v8/tools/profview/profview.js:891–925  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

889 }
890
891 onMouseUp(e) {
892 if (this.selectionStart !== null) {
893 let x = e.clientX - this.canvas.getBoundingClientRect().left;
894 if (Math.abs(x - this.selectionStart) < 10) {
895 this.selectionStart = null;
896 this.selectionEnd = null;
897 let ctx = this.canvas.getContext("2d");
898 ctx.drawImage(this.buffer, 0, this.imageOffset);
899 } else {
900 this.selectionEnd = x;
901 this.drawSelection();
902 }
903 let file = this.currentState.file;
904 if (file) {
905 let start = this.selectionStart === null ? 0 : this.selectionStart;
906 let end = this.selectionEnd === null ? Infinity : this.selectionEnd;
907 let firstTime = file.ticks[0].tm;
908 let lastTime = file.ticks[file.ticks.length - 1].tm;
909
910 let width = this.buffer.width;
911
912 start = (start / width) * (lastTime - firstTime) + firstTime;
913 end = (end / width) * (lastTime - firstTime) + firstTime;
914
915 if (end < start) {
916 let temp = start;
917 start = end;
918 end = temp;
919 }
920
921 main.setViewInterval(start, end);
922 }
923 }
924 this.selecting = false;
925 }
926
927 drawSelection() {
928 let ctx = this.canvas.getContext("2d");

Callers

nothing calls this directly

Calls 1

drawSelectionMethod · 0.95

Tested by

no test coverage detected