Ievgen Naida 5 жил өмнө
parent
commit
94ba6b6d52
1 өөрчлөгдсөн 12 нэмэгдсэн , 0 устгасан
  1. 12 0
      src/timeline.ts

+ 12 - 0
src/timeline.ts

@@ -1428,6 +1428,18 @@ export class Timeline extends TimelineEventsEmitter {
     this.renderTimeline();
   };
 
+  /**
+   * Get row by y coordinate.
+   * @param posY y screen coordinate.
+   */
+  public getRowByY(posY: number): TimelineRow {
+    const model = this.calculateRowsBounds();
+    if (model && model.rows) {
+      return model.rows.find((rowData) => rowData.y >= posY && posY <= rowData.y + rowData.height);
+    }
+
+    return null;
+  }
   /**
    * Find sharp pixel position
    */