pull/3282/head
Steve Ruiz 2024-04-18 15:28:48 +01:00
rodzic 3389687581
commit d1b270b4a3
3 zmienionych plików z 13 dodań i 16 usunięć

Wyświetl plik

@ -0,0 +1 @@

Wyświetl plik

@ -9143,7 +9143,7 @@ export class Editor extends EventEmitter<TLEventMap> {
// If we've lifted the space key,
if (info.code === 'Space') {
if (this.inputs.buttons.has(1)) {
if (this.inputs.buttons.has(MIDDLE_MOUSE_BUTTON)) {
// If we're still middle dragging, continue panning
} else {
// otherwise, stop panning
@ -9151,7 +9151,6 @@ export class Editor extends EventEmitter<TLEventMap> {
this.setCursor({ type: this._prevCursor, rotation: 0 })
}
}
break
}
case 'key_repeat': {
@ -9165,7 +9164,7 @@ export class Editor extends EventEmitter<TLEventMap> {
// Correct the info name for right / middle clicks
if (info.type === 'pointer') {
if (info.button === LEFT_MOUSE_BUTTON) {
if (info.button === MIDDLE_MOUSE_BUTTON) {
info.name = 'middle_click'
} else if (info.button === RIGHT_MOUSE_BUTTON) {
info.name = 'right_click'

Wyświetl plik

@ -99,12 +99,11 @@ export class ClickManager {
switch (info.name) {
case 'pointer_down': {
if (!this._clickState) return info
this._clickScreenPoint = Vec.From(info.point)
if (
this._previousScreenPoint &&
this._previousScreenPoint.dist(this._clickScreenPoint) > MAX_CLICK_DISTANCE
Vec.Dist2(this._previousScreenPoint, this._clickScreenPoint) > MAX_CLICK_DISTANCE ** 2
) {
this._clickState = 'idle'
}
@ -114,11 +113,6 @@ export class ClickManager {
this.lastPointerInfo = info
switch (this._clickState) {
case 'idle': {
this._clickState = 'pendingDouble'
this._clickTimeout = this._getClickTimeout(this._clickState)
return info // returns the pointer event
}
case 'pendingDouble': {
this._clickState = 'pendingTriple'
this._clickTimeout = this._getClickTimeout(this._clickState)
@ -149,21 +143,23 @@ export class ClickManager {
phase: 'down',
}
}
case 'idle': {
this._clickState = 'pendingDouble'
break
}
case 'pendingOverflow': {
this._clickState = 'overflow'
this._clickTimeout = this._getClickTimeout(this._clickState)
return info
break
}
default: {
// overflow
this._clickTimeout = this._getClickTimeout(this._clickState)
return info
}
}
this._clickTimeout = this._getClickTimeout(this._clickState)
return info
}
case 'pointer_up': {
if (!this._clickState) return info
this._clickScreenPoint = Vec.From(info.point)
switch (this._clickState) {
@ -193,9 +189,10 @@ export class ClickManager {
}
default: {
// idle, pendingDouble, overflow
return info
}
}
return info
}
case 'pointer_move': {
if (