View and Data API Tips: how to make viewer full screen
By Daniel Du
If you have not heard of View and Data API, here is the idea, the View & Data API enables web developers to very easily display 3D (and 2D) models on a WebGL-enabled browser. please read this one first and get a key from http://developer.autodesk.com and start playing with the API. In this blog post, I will paste some code snippet of making the viewer into full screen mode. Hope it is helpful :
Following code snippet make the viewer full browser.
$('#btnFullBrowser').click(function () {
var vsmd = new Autodesk.Viewing.ViewerScreenModeDelegate(viewer);
var oldMode = vsmd.getMode();
console.log(oldMode);//kFullScreen, kFullBrowser, kNormal
if (vsmd.isModeSupported(Autodesk.Viewing.Viewer
.ScreenMode.kFullBrowser)) {
var newMode = Autodesk.Viewing.Viewer.ScreenMode.kFullBrowser;
vsmd.doScreenModeChange(oldMode, newMode)
//vsmd.setMode(newMode);
}
else {
console.log('ScreenMode.kFullBrowser not supported');
}
});
What exactly “full browser” means? it hides any other html elements and enlarges the viewer to make it fulfill the whole browser in current tab. For example, I have a test application like below, please note that I have a title in my application, and some buttons, also note that this application is just one of many browser tabs.

If you I click the ‘full browser ’ button to run following code snippet, here is what I get, the viewer is full of the current browser tab, actually my browser is just part of my desktop, I can see other windows like terminal window, my text editor window, etc. If I press “Escape” key, it returns to normal mode:
Following code demos making viewer full screen. With full screen mode, you will get an immersive experience, all other browser tabs and other windows are hidden, the viewer takes the whole screen, if you are doing a game or virtual reality application, like this one, you may want to use full screen mode.
$('#btnFullScreen').click(function () {
var vsmd = new Autodesk.Viewing.ViewerScreenModeDelegate(viewer);
var oldMode = vsmd.getMode();
console.log(oldMode);//kFullScreen, kFullBrowser, kNormal
if (vsmd.isModeSupported(Autodesk.Viewing.Viewer
.ScreenMode.kFullScreen)) {
var newMode = Autodesk.Viewing.Viewer.ScreenMode.kFullScreen;
vsmd.doScreenModeChange(oldMode, newMode)
//asmd.setMode(newMode);
}
else {
console.log('ScreenMode.kFullScreen not supported');
}
});
For more code samples, please go to our sample home page: https://developer-autodesk.github.io/
View and Data API Tips: how to make viewer full screen的更多相关文章
- View and Data API Tips: Hide elements in viewer completely
By Daniel Du With View and Data API, you can hide some elements in viewer by calling "viewer.hi ...
- View and Data API Tips: Constrain Viewer Within a div Container
By Daniel Du When working with View and Data API, you probably want to contain viewer into a <div ...
- View and Data API tips: 缓存Access Token
对于云API服务,常见的方式就是按照API调用次数收费,某些API调用也就有某些限制,比如在特定时间内只允许调用指定的次数以免造成滥用.虽然Autodesk的view and Data API目前还没 ...
- View and Data API Tips : Conversion between DbId and node
By Daniel Du In View and Data client side API, The assets in the Autodesk Viewer have an object tree ...
- View and Data API 现在支持IE11了
By Daniel Du After a long time waiting, IE11 finally supports WebGL, which enables us viewing our 3D ...
- Autodesk View and Data API二次开发学习指南
什么是View and Data API? 使用View and Data API,你可以轻松的在网页上显示大型三维模型或者二维图纸而不需要安装任何插件.通过View and Data API,你可以 ...
- Using View and Data API with Meteor
By Daniel Du I have been studying Meteor these days, and find that Meteor is really a mind-blowing f ...
- 使用AxisHelper帮助理解View and Data API中的坐标系统
大家使用View and Data API做三维模型开发,必然首先要理解View and Data API的坐标系统,即XYZ三个轴向分别是怎么定义的.Three.js里面提供了一个AxisHelpe ...
- 在View and Data API中更改指定元素的颜色
大家在使用View and Data API开发过程中,经常会用到的就是改变某些元素的颜色已区别显示.比如根据某些属性做不同颜色的专题显示,或者用不同颜色表示施工进度,或者只是简单的以颜色变化来提醒用 ...
随机推荐
- <nginx.conf> nginx用户权限
Nginx用户权限 在nginx.conf文件的第一行一般是设置用户的地方(编译安装nginx时的参数--user=<user>也是指定用户的地方),如 user www www; 如不指 ...
- 比较一下以“反射”和“表达式”执行方法的性能差异
由于频繁地使用反射会影响性能,所以ASP.NET MVC采用了表达式树的方式来执行目标Action方法.具体来说,ASP.NET MVC会构建一个表达式来体现针对目标Action方法的执行,并且将该表 ...
- java.util.NoSuchElementException: Timeout waiting for idle object
出现这个问题第一个想法就是连接池的参数设置问题,把最大连接数量设置大一些就行了,但是我就一个客服端访问服务器,连接池连接数量不可能会不够用.我的项目架构是spring mvc+hibernate,用s ...
- ONE
我是漆黑夜空中 闪烁凄凄的一颗星 遥隔千里的双眸一遇 看到了,你那藏在泪光里的话 你一个人 把泪擦干 把话捏在手心 陪着我,承受着黑夜的孤独 说明:来自落网的一个期刊<ONE>. 听这个期 ...
- 关于 android 的 view.getLeft(), getRight(), getTop(), getBottom() 的一些疑惑(坑)解答
(原创) 今天在做下滑刷新的时候碰到 view 的四个 get 函数有点特别,具体遇到的问题如下,经反复测试和查找资料,填坑如下: 1,为什么我有时候在使用getLeft(), getRight(), ...
- Oracle库Delete删除千万以上普通堆表数据的方法
需求:Oracle数据库delete删除普通堆表千万条历史记录. 直接删除的影响: 1.可能由于undo表空间不足从而导致最终删除失败的问题: 2.可能导致undo表空间过度使用,影响到其他用户正常操 ...
- 局部打印插件 jquery.PrintArea.js
(function ($) { var printAreaCount = 0; $.fn.printArea = function () { var ele = $(this); var idPref ...
- 10.Struts2连接数据库
链接数据库的两种方式: 1.在Action中连接数据库 2.使用工具类连接数据库 1.在Action中连接数据库 源码文档目录如图所示: 1.建立数据库 数据库建立语句: create databas ...
- 一个基于mysql构建的队列表
通常大家都会使用redis作为应用的任务队列表,redis的List结构,在一段进行任务的插入,在另一端进行任务的提取. 任务的插入 $redis->lPush("key:task:l ...
- 【Basics of Entity Framework】【EF基础系列1】
EF自己包括看视频,看MSDN零零散散的学了一点皮毛,这次打算系统学习一下EF.我将会使用VS2012来学习这个EF基础系列. 现在看看EF的历史吧: EF版本 相关版本特性介绍 EF3.5 基于数据 ...