[fix] Replace findLast for browser compat (#1822)

Previously, we'd used `Array.findLast` in `getSelectedShapeAtPoint`.
This PR removes that newish JS call and replaces it with a `replace` and
`find` instead. Closes bug mentioned in
https://github.com/tldraw/tldraw/issues/1798.

### Change Type

- [x] `patch` — Bug fix
This commit is contained in:
Steve Ruiz 2023-08-25 07:57:20 +02:00 committed by GitHub
parent 57b2cf6955
commit fd71bd1b5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4232,7 +4232,8 @@ export class Editor extends EventEmitter<TLEventMap> {
const { selectedShapeIds } = this
return this.currentPageShapesSorted
.filter((shape) => shape.type !== 'group' && selectedShapeIds.includes(shape.id))
.findLast((shape) => this.isPointInShape(shape, point, { hitInside: true, margin: 0 }))
.reverse() // findlast
.find((shape) => this.isPointInShape(shape, point, { hitInside: true, margin: 0 }))
}
/**