remove dots in geometric shapes (#613)

scrolling-menus
Steve Ruiz 2022-03-09 13:04:39 +00:00 zatwierdzone przez GitHub
rodzic 15e3e9805f
commit 99dd67cd81
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 21 dodań i 5 usunięć

Wyświetl plik

@ -452,7 +452,10 @@ describe('TldrawTestApp', () => {
const prevA = app.shapes.map((shape) => shape.id)
app.pointCanvas({ x: 0, y: 0 }).movePointer({ x: 100, y: 100 }).stopPointing()
app
.pointCanvas({ x: 0, y: 0 })
.movePointer({ x: 100, y: 100 })
.stopPointing('canvas', [100, 100])
const newIdA = app.shapes.map((shape) => shape.id).find((id) => !prevA.includes(id))!
const shapeA = app.getShape(newIdA)
@ -467,7 +470,10 @@ describe('TldrawTestApp', () => {
const prevB = app.shapes.map((shape) => shape.id)
app.pointCanvas({ x: 0, y: 0 }).movePointer({ x: 100, y: 100 }).stopPointing()
app
.pointCanvas({ x: 0, y: 0 })
.movePointer({ x: 100, y: 100 })
.stopPointing('canvas', [100, 100])
const newIdB = app.shapes.map((shape) => shape.id).find((id) => !prevB.includes(id))!
const shapeB = app.getShape(newIdB)

Wyświetl plik

@ -3181,7 +3181,6 @@ export class TldrawApp extends StateManager<TDSnapshot> {
onPointerMove: TLPointerEventHandler = (info, e) => {
this.previousPoint = this.currentPoint
this.updateInputs(info, e)
if (this.isForcePanning && this.isPointing) {
this.onPan?.({ ...info, delta: Vec.neg(info.delta) }, e as unknown as WheelEvent)
return

Wyświetl plik

@ -216,12 +216,13 @@ describe('Transform session', () => {
})
describe('When creating with a transform session', () => {
it('Deletes the shape on undo', () => {
it.only('Deletes the shape on undo', () => {
const app = new TldrawTestApp()
.selectTool(TDShapeType.Rectangle)
.pointCanvas([0, 0])
.movePointer([5, 5])
.movePointer([10, 10])
.stopPointing()
.stopPointing('canvas', [10, 10])
expect(app.shapes.length).toBe(1)

Wyświetl plik

@ -269,6 +269,10 @@ export class TransformSession extends BaseSession {
if (!hasUnlockedShapes) return
if (this.isCreate && Vec.dist(this.app.originPoint, this.app.currentPoint) < 2) {
return this.cancel()
}
const beforeShapes: Record<string, TDShape | undefined> = {}
const afterShapes: Record<string, TDShape> = {}

Wyświetl plik

@ -228,6 +228,12 @@ export class TransformSingleSession extends BaseSession {
if (initialShape.isLocked) return
console.log('completed', this.app.originPoint, this.app.currentPoint)
if (this.isCreate && Vec.dist(this.app.originPoint, this.app.currentPoint) < 2) {
return this.cancel()
}
const beforeShapes = {} as Record<string, Partial<TDShape> | undefined>
const afterShapes = {} as Record<string, Partial<TDShape>>