handleFrameMaskClickEvent()

in frontend/src/components/jfr/flame-graph.js [1076:1127]


    handleFrameMaskClickEvent(e) {
      if (window.getSelection().type === 'Range') {
        e.stopPropagation();
        return;
      }

      if (this.$currentFrame === this.$root) {
        return;
      }

      if (!this.$pinned) {
        this.$pinned = true;
        this.$pinnedFrame = this.$currentFrame;
        this.$pinnedFrame.setPinned();
        this.$pinnedFrame.findSide();
      } else {
        if (this.$pinnedFrame === this.$currentFrame) {
          this.$pinnedFrame.setUnpinned();
          this.$pinnedFrame.clearFindSide();
          this.$pinnedFrame = null;
          this.$pinnedFrameMask.style.visibility = 'hidden';
          this.$pinned = false;
        } else {
          this.$pinnedFrame.setUnpinned();
          this.$pinnedFrame.clearFindSide();
          this.$pinnedFrame = this.$currentFrame;
          this.$pinnedFrame.setPinned();
          this.$pinnedFrame.findSide();
        }
      }

      this.render(false, false);

      if (this.$pinned && this.$pinnedFrame) {
        this.$pinnedFrameMask.style.left = this.$pinnedFrame.x + 'px';
        this.$pinnedFrameMask.style.top = this.$pinnedFrame.y + 'px';
        this.$pinnedFrameMask.style.width = this.$pinnedFrame.width + 'px';
        this.$pinnedFrameMask.style.height = this.$pinnedFrame.height + 'px';
        this.$pinnedFrameMask.style.visibility = 'visible';
      }

      let ne = new Event('mousemove');
      ne.offsetX = this.$frameMask.offsetLeft + e.offsetX;
      ne.offsetY = this.$frameMask.offsetTop + e.offsetY;

      this.$framePostcard.style.visibility = 'hidden';
      this.$frameMask.style.cursor = 'default';
      this.$frameMask.style.visibility = 'hidden';

      this.$canvas.dispatchEvent(ne);
      e.stopPropagation();
    }