-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into windows-arm-support
- Loading branch information
Showing
133 changed files
with
6,816 additions
and
1,043 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Disposable, Emitter } from 'event-kit' | ||
|
||
/** | ||
* The drag and drop manager is implemented to manage drag and drop events | ||
* that we want to track app wide without updating the enter app state. | ||
* | ||
* This was specifically implemented due to reduced performance during drag and | ||
* drop when updating app state variables to track drag element changes during a | ||
* drag event. | ||
*/ | ||
export class DragAndDropManager { | ||
private _isDragInProgress: boolean = false | ||
|
||
protected readonly emitter = new Emitter() | ||
|
||
public get isDragInProgress(): boolean { | ||
return this._isDragInProgress | ||
} | ||
|
||
public emitEnterDropTarget(targetDescription: string) { | ||
this.emitter.emit('enter-drop-target', targetDescription) | ||
} | ||
|
||
public emitLeaveDropTarget() { | ||
this.emitter.emit('leave-drop-target', {}) | ||
} | ||
|
||
public onEnterDropTarget( | ||
fn: (targetDescription: string) => void | ||
): Disposable { | ||
return this.emitter.on('enter-drop-target', fn) | ||
} | ||
|
||
public onLeaveDropTarget(fn: () => void): Disposable { | ||
return this.emitter.on('leave-drop-target', fn) | ||
} | ||
|
||
public dragStarted(): void { | ||
this._isDragInProgress = true | ||
} | ||
|
||
public dragEnded() { | ||
this._isDragInProgress = false | ||
} | ||
|
||
public emitEnterDragZone(dropZoneDescription: string) { | ||
this.emitter.emit('enter-drop-zone', dropZoneDescription) | ||
} | ||
|
||
public onEnterDragZone( | ||
fn: (dropZoneDescription: string) => void | ||
): Disposable { | ||
return this.emitter.on('enter-drop-zone', fn) | ||
} | ||
} | ||
|
||
export const dragAndDropManager = new DragAndDropManager() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.