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. 前端学PHP之数据类型

    × 目录 [1]总括 [2]布尔型 [3]整型[4]浮点型[5]字符串[6]数组[7]对象[8]NULL[9]资源 前面的话 同javascript一样,php也是一门弱类型语言,或者说成类型松散的语 ...

  2. Android Fragment---执行Fragment事务

    转载博客:http://blog.csdn.net/think_soft/article/details/7272853 在Activity中使用有关Fragment的添加.删除.替换以及用它们执行其 ...

  3. 【原创】开源Math.NET基础数学类库使用(04)C#解析Matrix Marke数据格式

                   本博客所有文章分类的总目录:[总目录]本博客博文总目录-实时更新  开源Math.NET基础数学类库使用总目录:[目录]开源Math.NET基础数学类库使用总目录 前言 ...

  4. JavaScript阻塞剖析与改善

    一.阻塞特性 <高性能JavaScript>一书中,关于第一章“Loading and Execution”,提到了无阻塞加载JavaScript技术,目的是为了提高页面呈现速度. 说到无 ...

  5. 支持向量机原理(四)SMO算法原理

    支持向量机原理(一) 线性支持向量机 支持向量机原理(二) 线性支持向量机的软间隔最大化模型 支持向量机原理(三)线性不可分支持向量机与核函数 支持向量机原理(四)SMO算法原理 支持向量机原理(五) ...

  6. iOS开发之多表视图滑动切换示例(仿"头条"客户端)---优化篇

    前几天发布了一篇iOS开发之多表视图滑动切换示例(仿"头条"客户端)的博客,之所以写这篇博客,是因为一位iOS初学者提了一个问题,简单的写了个demo做了个示范,让其在基础上做扩展 ...

  7. spring boot源码分析之SpringApplication

    spring boot提供了sample程序,学习spring boot之前先跑一个最简单的示例: /* * Copyright 2012-2016 the original author or au ...

  8. 把《c++ primer》读薄(4-2 c和c++的数组 和 指针初探)

    督促读书,总结精华,提炼笔记,抛砖引玉,有不合适的地方,欢迎留言指正. 问题1.我们知道,将一个数组赋给另一个数组,就是将一个数组的元素逐个赋值给另一数组的对应元素,相应的,将一个vector 赋给另 ...

  9. Ajax.BeginForm VS Html.BeginForm

    有的人说,AJAX一听,高大上,HTML一听,死老土,所以AJAX更好.其实这是错误的.每种方法有它不同的用途.现在做如下总结: @using (Ajax.BeginForm("Login& ...

  10. H5基于iScroll实现下拉刷新,上拉加载更多

    前言 前一段有个手机端的项目需要用到下拉刷新和上拉加载更多的效果,脑海里第一反映就是微博那种效果,刚开始的理解有些偏差,以为下拉也是追加数据,上拉也是追加数据,后请教同事后发现其实下拉只是刷新最新数据 ...