mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
wip: basic list dnd with animation
This commit is contained in:
@@ -11,7 +11,7 @@ import { TimeoutTimer } from 'vs/base/common/async';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
|
||||
@@ -1157,3 +1157,18 @@ export function windowOpenNoOpener(url: string): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function animate(fn: () => void): IDisposable {
|
||||
const step = () => {
|
||||
fn();
|
||||
stepDisposable = scheduleAtNextAnimationFrame(step);
|
||||
};
|
||||
|
||||
let stepDisposable = scheduleAtNextAnimationFrame(step);
|
||||
return toDisposable(() => stepDisposable.dispose());
|
||||
}
|
||||
|
||||
export function timeout(fn: () => void, millis: number): IDisposable {
|
||||
const timer = setTimeout(fn, millis);
|
||||
return toDisposable(() => clearTimeout(timer));
|
||||
}
|
||||
Reference in New Issue
Block a user