Google chrome 启用pinch以放大chrome应用程序
目前,我正在开发一个包含谷歌地图的Chrome打包应用程序。但是,我无法使用“收缩”进行缩放。此外,网页上的“正常”缩放也不起作用 如果我直接在Google Chrome中打开我使用的所有页面(和地图),它们都可以缩小,但我似乎无法在软件包应用程序中工作。有什么想法吗?这可能是权限问题还是WindowOptions问题 在Mac 10.11.3上工作。Chrome版本48.0.2564.116 简单示例(dropbox链接): manifest.jsonGoogle chrome 启用pinch以放大chrome应用程序,google-chrome,google-chrome-app,gestures,pinchzoom,Google Chrome,Google Chrome App,Gestures,Pinchzoom,目前,我正在开发一个包含谷歌地图的Chrome打包应用程序。但是,我无法使用“收缩”进行缩放。此外,网页上的“正常”缩放也不起作用 如果我直接在Google Chrome中打开我使用的所有页面(和地图),它们都可以缩小,但我似乎无法在软件包应用程序中工作。有什么想法吗?这可能是权限问题还是WindowOptions问题 在Mac 10.11.3上工作。Chrome版本48.0.2564.116 简单示例(dropbox链接): manifest.json { "name": "Zoom
{
"name": "Zoom test",
"version": "0.1",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js"]
}
}
}
background.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
innerBounds: { width: 800, height: 600 },
state: 'normal'
});
});
index.html
<html>
<head>
<style>
p {
width: 400px;
}
</style>
</head>
<body>
<p>This page is zoomable in Google Chrome if opened directly,
but not if run as an app.</p>
</body>
</html>
p{
宽度:400px;
}
如果直接打开,此页面在Google Chrome中可以缩放,
但如果作为应用程序运行,则不会
我使用以下功能修复了它:
function mapTouchFix(){
if("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch){
navigator = navigator || {};
if(navigator.platform!='MacIntel'){
navigator.msMaxTouchPoints = navigator.msMaxTouchPoints || 2;
}
}
}
显然,这欺骗了Chrome/GoogleMaps来启用捏手势向我们展示了如何嵌入地图。我还有非地图页面。当直接在Chrome中打开它们时,我可以用钳子放大HTML页面。但在Chrome应用程序中我不能。有没有我错过的场景?也许吧。不过,请给出一个最小的示例。我也会尝试在这里发布代码,不运行,这很简单。与缩放无关-它根本不起作用。