Merge pull request #102 from Hufe921/feature/drag

feat:add isPointInRange function to Range
pr675
Hufe 3 years ago committed by GitHub
commit 78b5bb7ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -61,6 +61,18 @@ export class RangeManager {
return rangeRow return rangeRow
} }
public getIsPointInRange(x: number, y: number): boolean {
const { startIndex, endIndex } = this.range
const positionList = this.position.getPositionList()
for (let p = startIndex + 1; p <= endIndex; p++) {
const { coordinate: { leftTop, rightBottom } } = positionList[p]
if (x >= leftTop[0] && x <= rightBottom[0] && y >= leftTop[1] && y <= rightBottom[1]) {
return true
}
}
return false
}
public setRange( public setRange(
startIndex: number, startIndex: number,
endIndex: number, endIndex: number,

Loading…
Cancel
Save