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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. View and Data API tips: 缓存Access Token

    对于云API服务,常见的方式就是按照API调用次数收费,某些API调用也就有某些限制,比如在特定时间内只允许调用指定的次数以免造成滥用.虽然Autodesk的view and Data API目前还没 ...

  4. 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 ...

  5. View and Data API 现在支持IE11了

    By Daniel Du After a long time waiting, IE11 finally supports WebGL, which enables us viewing our 3D ...

  6. Autodesk View and Data API二次开发学习指南

    什么是View and Data API? 使用View and Data API,你可以轻松的在网页上显示大型三维模型或者二维图纸而不需要安装任何插件.通过View and Data API,你可以 ...

  7. 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 ...

  8. 使用AxisHelper帮助理解View and Data API中的坐标系统

    大家使用View and Data API做三维模型开发,必然首先要理解View and Data API的坐标系统,即XYZ三个轴向分别是怎么定义的.Three.js里面提供了一个AxisHelpe ...

  9. 在View and Data API中更改指定元素的颜色

    大家在使用View and Data API开发过程中,经常会用到的就是改变某些元素的颜色已区别显示.比如根据某些属性做不同颜色的专题显示,或者用不同颜色表示施工进度,或者只是简单的以颜色变化来提醒用 ...

随机推荐

  1. 深入学习jQuery鼠标事件

    × 目录 [1]类型 [2]写法 [3]合成事件[4]鼠标按键[5]修改键[6]坐标位置 前面的话 鼠标事件是DOM事件中最常用的事件,jQuery对鼠标事件进行了封装和扩展.本文将详细介绍jQuer ...

  2. java中两种添加监听器的策略

    /*第一种:将事件的处理委托给其他对象,下面的例子是委托给了MyListener(implements ActionListener)*/ 1 import java.applet.Applet; i ...

  3. 白话贝叶斯理论及在足球比赛结果预测中的应用和C#实现

    离去年“马尔可夫链进行彩票预测”已经一年了,同时我也计划了一个彩票数据框架的搭建,分析和预测的框架,会在今年逐步发表,拟定了一个目录,大家有什么样的意见和和问题,可以看看,留言我会在后面的文章中逐步改 ...

  4. 这算是ASP.NET MVC的一个大BUG吗?

    这是昨天一个同事遇到的问题,我觉得这是一个蛮大的问题,而且不像是ASP.NET MVC的设计者有意为之,换言之,这可能是ASP.NET MVC的一个Bug(不过也有可能是保持原始请求数据而作的妥协). ...

  5. 缓存Cookie、session、localStorage的区别

    cookie Cookie就是服务器暂存放在你计算机上的一笔资料,好让服务器用来辨认你的计算机.当你在浏览网站的时候,Web服务器会先送一小小资料放在你的计算机上,Cookie 会帮你在网站上所打的文 ...

  6. C# 设置word文档页面大小

    我们知道,在MS word中,默认的页面大小是letter(8.5’’x11’’),除此之外,word还提供了其他一些预定义的页面大小,如Legal (5.4’’x14’’),A3 (11.69’’x ...

  7. js 利用throw 写的一个小程序

    在下边的小程序中比较特殊的是使用isNaN()函数判断一个参数是不是数字, <!DOCTYPE html> <!DOCTYPE html> <html> <h ...

  8. 汽车之家一道SQL 面试题,大家闲来无事都来敲一敲

    写在前面 上周去汽车之家面试,拿到这个SQL笔试题顿时感觉到有些陌生,因为好长时间不写SQL语句了,当时只写了表设计,示例数据和SQL语句都没写出来. 汽车之家应该用的SQL Server, 编程题一 ...

  9. Vagrant入门

    简单地说,Vagrant让我们可以通过代码的方式快速地.可重复地创建针对不同虚拟环境的虚拟机,包括Virtualbox.AWS.Docker等.它使得我们可以一次性地.自动创建多个环境相同的虚拟机,对 ...

  10. Not a git repository (or any of the parent directories): .git

    今天准备在win10上面安装git,想把代码发布到github中,按照教程的方法一步一步下来,当配置完ssh和用户名,邮箱之后,发现下拉不下来github中的代码,出现如下错误. 说是没有发现仓储,很 ...