mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 15:25:47 +01:00
Fixes #959: Do not use translate3d when the zoomLevel is not 0
This commit is contained in:
@@ -6,46 +6,42 @@
|
||||
|
||||
import types = require('vs/base/common/types');
|
||||
import * as Platform from 'vs/base/common/platform';
|
||||
import Event, {Emitter} from 'vs/base/common/event';
|
||||
import {IDisposable} from 'vs/base/common/lifecycle';
|
||||
|
||||
interface ISafeWindow {
|
||||
Worker: any;
|
||||
class ZoomManager {
|
||||
|
||||
public static INSTANCE = new ZoomManager();
|
||||
|
||||
private _zoomLevel: number = 0;
|
||||
|
||||
private _onDidChangeZoomLevel: Emitter<number> = new Emitter<number>();
|
||||
public onDidChangeZoomLevel:Event<number> = this._onDidChangeZoomLevel.event;
|
||||
public getZoomLevel(): number {
|
||||
return this._zoomLevel;
|
||||
}
|
||||
|
||||
public setZoomLevel(zoomLevel:number): void {
|
||||
if (this._zoomLevel === zoomLevel) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._zoomLevel = zoomLevel;
|
||||
this._onDidChangeZoomLevel.fire(this._zoomLevel);
|
||||
}
|
||||
}
|
||||
|
||||
interface ISafeDocument {
|
||||
URL: string;
|
||||
createElement(tagName: 'div'): HTMLDivElement;
|
||||
createElement(tagName: string): HTMLElement;
|
||||
export function getZoomLevel(): number {
|
||||
return ZoomManager.INSTANCE.getZoomLevel();
|
||||
}
|
||||
export function setZoomLevel(zoomLevel:number): void {
|
||||
ZoomManager.INSTANCE.setZoomLevel(zoomLevel);
|
||||
}
|
||||
export function onDidChangeZoomLevel(callback:(zoomLevel:number)=>void): IDisposable {
|
||||
return ZoomManager.INSTANCE.onDidChangeZoomLevel(callback);
|
||||
}
|
||||
|
||||
interface INavigator {
|
||||
userAgent: string;
|
||||
}
|
||||
|
||||
interface IGlobalScope {
|
||||
navigator: INavigator;
|
||||
document: ISafeDocument;
|
||||
history: {
|
||||
pushState: any
|
||||
};
|
||||
}
|
||||
|
||||
const globals = <IGlobalScope><any>(typeof self === 'object' ? self : global);
|
||||
|
||||
// MAC:
|
||||
// chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.100 Safari/535.2"
|
||||
// safari: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22"
|
||||
//
|
||||
// WINDOWS:
|
||||
// chrome: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.102 Safari/535.2"
|
||||
// IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MS-RTC LM 8; InfoPath.3; Zune 4.7)"
|
||||
// Opera: "Opera/9.80 (Windows NT 6.1; U; en) Presto/2.9.168 Version/11.52"
|
||||
// FF: "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0"
|
||||
|
||||
// LINUX:
|
||||
// chrome: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
|
||||
// firefox: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0"
|
||||
|
||||
const userAgent = globals.navigator ? globals.navigator.userAgent : '';
|
||||
const userAgent = navigator.userAgent;
|
||||
|
||||
// DOCUMENTED FOR FUTURE REFERENCE:
|
||||
// When running IE11 in IE10 document mode, the code below will identify the browser as being IE10,
|
||||
@@ -76,12 +72,8 @@ export function hasCSSAnimationSupport() {
|
||||
return this._hasCSSAnimationSupport;
|
||||
}
|
||||
|
||||
if (!globals.document) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let supported = false;
|
||||
let element = globals.document.createElement('div');
|
||||
let element = document.createElement('div');
|
||||
let properties = ['animationName', 'webkitAnimationName', 'msAnimationName', 'MozAnimationName', 'OAnimationName'];
|
||||
for (let i = 0; i < properties.length; i++) {
|
||||
let property = properties[i];
|
||||
|
||||
Reference in New Issue
Block a user