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.

image

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/

作者: 峻祁连
邮箱:junqilian@163.com 
出处: http://junqilian.cnblogs.com 
转载请保留此信息。



本文转自峻祁连. Moving to Cloud/Mobile博客园博客,原文链接:http://www.cnblogs.com/junqilian/p/4272035.html ,如需转载请自行联系原作者
相关文章
|
Java API Spring
Spring Data Solr的api demo测试操作
Spring Data Solr的api demo测试操作
161 0
Spring Data Solr的api demo测试操作
|
SQL 存储 缓存
深入解析 RDS Serverless 之 Data API
RDS Serverless Data API 已发布
深入解析 RDS Serverless 之 Data API
|
Java 数据库连接 API
Spring Data开发手册|Java持久化API(JPA)需要了解到什么程度呢?
JPA,Java Persistence API是Sun官方提出的Java持久化规范。它为Java开发人员提供了一种对象/关联映射工具来管理Java应用中的关系数据。它的出现主要是为了简...
513 0
|
Web App开发 API 开发者
SAP 电商云 Spartacus UI 同 SAP Customer Data Cloud 集成运行时的 api
SAP 电商云 Spartacus UI 同 SAP Customer Data Cloud 集成运行时的 api
140 0
SAP 电商云 Spartacus UI 同 SAP Customer Data Cloud 集成运行时的 api
|
Web App开发 API 开发者
SAP 电商云 Spartacus UI 同 SAP Customer Data Cloud 集成运行时的 api
SAP 电商云 Spartacus UI 同 SAP Customer Data Cloud 集成运行时的 api
SAP 电商云 Spartacus UI 同 SAP Customer Data Cloud 集成运行时的 api
|
.NET API 开发框架
从零开始学习 asp.net core 2.1 web api 后端api基础框架(三)-创建Data Transfer Object
原文:从零开始学习 asp.net core 2.1 web api 后端api基础框架(三)-创建Data Transfer Object 版权声明:本文为博主原创文章,未经博主允许不得转载。
1127 0