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/

时间: 2024-11-07 23:38:41

View and Data API Tips: how to make viewer full screen的相关文章

View and Data API tips: 缓存Access Token

对于云API服务,常见的方式就是按照API调用次数收费,某些API调用也就有某些限制,比如在特定时间内只允许调用指定的次数以免造成滥用.虽然Autodesk的view and Data API目前还没有应用这样的限制,但我们最好也能实现这样的机制,比如对于或者Access Token这样的操作,一个Access Token是有一定的有效期的,在这个token的有效期内,我们就没必要重复发出API调用获取新的Acces Token,只有返回仍然有效的token就可以了.下面是c#实现的简单的逻辑,

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, a tree structure that represents the model hierarchy. Each element in model can be representing as a node of model tree. Each node has a dbId, this

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 framework, I can talk about this latter. I was inspired by this question on forum and started to looking at the possibilities of using View and Data AP

Autodesk View and Data API用户调查

相信大家已经听过Autodesk View and Data Web Service (API) 了吧,还没有? 下面这个就是用Autodesk View and Data Web Service嵌入的模型哦,先玩儿玩儿吧 :)   你也可以把这个模型嵌入到你自己的网站中. 我在和客户交流的时候,很多人都反应云服务器在国外,中国用户使用上就比较犹豫,那么如果把服务器架设在国内,你会用吗?做一下调查吧,让Autodesk听到你的声音.常言道,会哭的孩子有奶吃,不会哭的孩子被饿死啊,5555~  

Autodesk View and Data API练练手

大家如果参加过我们的活动,你应该已经听过看过不少关于View and Data Web Service的例子里,如果还没有的话,请看看下面这几篇: http://www.cnblogs.com/junqilian/category/594048.html 如果你已经了解了Viewer,那有没有兴趣练练手,把这样酷的三维模型嵌入到你自己的网页中呢?那么开始练练手吧. ?体验代码资料下载:http://pan.baidu.com/s/15zZMQ 在下载解压缩后你应该可以看到下面的目录结构,其中ha

初探物联网 - 基于Arduino的气象站和View and Data API的结合实例

如果你参加了上个月在北京的Autodesk 开发者日,你应该看到了我做的关于Arduino的物联网实例演示,如果你没看到,欢迎参加14号在上海的开发者日,到时候我会再演(xian)示(bai)一下. 这是个基于这样一个场景的简单演示.我的一个建筑物上面安装了这样一个温度传感器,随时把当前环境温度上传到云端,在浏览器端可以显示这个建筑物的三维模型和温度变化曲线图.如果温度到达一定的高温,比如大于40度,那可能是起火了,就需要发出高温报警,在三维模型中定位出报警的温度传感器的位置,并发出火警警报.

使用View为Data Source的Form开发要点

(Data Source为View) 要点一:创建View的SQL语法 View的SQL里必须指定Form里唯一一个对其新增.修改.删除的基本表及其主键,其它表为辅助信息表,其字段仅用来在Form里显示.如下例: NCINV_SUB_PERSON_HEADERS 为基本表,主键为HEADER_ID PER_PEOPLE_F 为辅助表 要点二:Form里的Block属性设置 Database属性集的Query Database Source Name属性为视图名,如:NCINV_SUB_PERSO

ASP.NET MVC View 和 Web API 的基本权限验证

ASP.NET MVC 5.0已经发布一段时间了,适应了一段时间,准备把原来的MVC项目重构了一遍,先把基本权限验证这块记录一下. 环境:Windows 7 Professional SP1 + Microsoft Visual Studio 2013(MVC 5 + Web API 2) 修改Web.config,增加Forms验证模式,在system.web节点中增加以下配置: <authentication mode="Forms"> <forms loginU

Gluon Data API

http://mxnet.apache.org/api/python/gluon/data.html import sys import os import time import mxnet as mx from mxnet import autograd,nd from mxnet import gluon,init from mxnet.gluon import data as gdata,loss as gloss from mxnet.gluon import nn #gdata.Ar