Skip to content

Commit

Permalink
Forms Elements (#9)
Browse files Browse the repository at this point in the history
* update scripts

* testing script

* update permission

* update working-directory

* Raised quality bar

* improved performance

* update script

* update error code

* Raised the bar

* Update conditional

* Fixed type error

* Update beta

* cdn autodesk

* cdn autodesk comments

* comments canvas

* html comments

* matterport comments

* threejs comments

* cdn matterport

* cdn mouse

* cdn real time

* cdn three

* video cdn

* cdn wio

* Update CDN Projects

* update version

* update type

* Added Form Elements to samples

* Fixed project infos

* Fixed type check
  • Loading branch information
vtnorton authored Jun 12, 2024
1 parent 945b240 commit dd8a307
Show file tree
Hide file tree
Showing 92 changed files with 10,733 additions and 423 deletions.
2 changes: 1 addition & 1 deletion .admin/naming.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for dir in $(find ./../ -mindepth 3 -maxdepth 3 -type d ! -path "./../.git*"); d
jq --arg projectName "$projectName" --arg description "$description" '.name = $projectName | .description = $description' $dir/package.json > $dir/package.temp.json && mv $dir/package.temp.json $dir/package.json

# COPY the README.md file from the .admin folder to the project folder
# cp ./../.admin/README.md $dir/README.md
cp ./../.admin/README.md $dir/README.md

# Update first line of every README.md file
sed -i "1s|.*|# Sample for $fullProjectName|" $dir/README.md
Expand Down
104 changes: 104 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"prettier"
],
"extends": [
"plugin:prettier/recommended",
"plugin:react/recommended"
],
"env": {
"browser": true,
"es6": true
},
"settings": {
"react": {
"version": "17"
}
},
"rules": {
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 200,
"tabWidth": 2,
"useTabs": true,
"semi": false
}
],
"@typescript-eslint/consistent-type-definitions": [
"error",
"interface"
],
"@typescript-eslint/explicit-module-boundary-types": [
0
],
"@typescript-eslint/no-shadow": [
"error"
],
"@typescript-eslint/no-use-before-define": [
"error"
],
"react/jsx-one-expression-per-line": [
0
],
"react/jsx-props-no-spreading": "off",
"react/jsx-uses-react": [
0
],
"react/react-in-jsx-scope": [
0
],
"react/prop-types": [
0
],
"react/jsx-indent": [
0
],
"react/jsx-closing-bracket-location": [
"error",
{
"selfClosing": "after-props",
"nonEmpty": "after-props"
}
],
"jsx-quotes": [
"error",
"prefer-single"
],
"newline-per-chained-call": [
"error",
{
"ignoreChainWithDepth": 4
}
],
"no-console": "off",
"comma-dangle": [
"error",
"always-multiline"
],
"import/prefer-default-export": "off",
"func-names": "off",
"import/extensions": [
0
],
"no-shadow": "off",
"no-use-before-define": "off",
"max-len": "off",
"semi": [
"error",
"never"
],
"nonblock-statement-body-position": [
"error",
"below"
],
"quotes": [
"error",
"single"
]
}
}
19 changes: 19 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"trailingComma": "all",
"singleQuote": true,
"printWidth": 280,
"tabWidth": 2,
"useTabs": true,
"semi": false,
"jsxSingleQuote": true,
"bracketSameLine": true,
"arrowParens": "always",
"singleAttributePerLine": false,
"importOrder": [
"^components/(.*)$",
"^services/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
178 changes: 89 additions & 89 deletions js/cdn/autodesk/public/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,108 +1,108 @@
import { DEVELOPER_KEY, CLIENT_ID, CLIENT_SECRET } from "../env.js";
import { sampleInfo } from "./projectInfo.js";
import { DEVELOPER_KEY, CLIENT_ID, CLIENT_SECRET } from '../env.js'
import { sampleInfo } from '../projectInfo.js'

const participant = Math.floor(Math.random() * 100);
const groupId = sampleInfo.id;
const groupName = sampleInfo.name;
const participant = Math.floor(Math.random() * 100)
const groupId = sampleInfo.id
const groupName = sampleInfo.name

const FORGE_CLIENT = CLIENT_ID;
const FORGE_SECRET = CLIENT_SECRET;
const FORGE_CLIENT = CLIENT_ID
const FORGE_SECRET = CLIENT_SECRET

const AUTH_URL = "https://developer.api.autodesk.com/authentication/v2/token";
const modelURN = "urn:adsk.objects:os.object:e8d17563-1a4e-4471-bd72-a0a7e8d719bc/fileifc.ifc";
const AUTH_URL = 'https://developer.api.autodesk.com/authentication/v2/token'
const modelURN = 'urn:adsk.objects:os.object:e8d17563-1a4e-4471-bd72-a0a7e8d719bc/fileifc.ifc'
const AutodeskData = {
grant_type: "client_credentials",
scope: "data:read bucket:read",
};
const token = btoa(`${FORGE_CLIENT}:${FORGE_SECRET}`);
grant_type: 'client_credentials',
scope: 'data:read bucket:read',
}
const token = btoa(`${FORGE_CLIENT}:${FORGE_SECRET}`)

function InitAutodesk() {
const contentSection = document.getElementById("zeus-participant");
let viewer = null;
const contentSection = document.getElementById('zeus-participant')
let viewer = null

fetch(AUTH_URL, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded", Authorization: `Basic ${token}` },
body: new URLSearchParams(AutodeskData).toString(),
})
.then((res) => {
return res.json();
})
.then((dataToken) => {
const options = {
env: "AutodeskProduction2",
api: "streamingV2",
accessToken: dataToken.access_token,
};
fetch(AUTH_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded', Authorization: `Basic ${token}` },
body: new URLSearchParams(AutodeskData).toString(),
})
.then((res) => {
return res.json()
})
.then((dataToken) => {
const options = {
env: 'AutodeskProduction2',
api: 'streamingV2',
accessToken: dataToken.access_token,
}

const modelID = btoa(modelURN);
var documentId = `urn:${modelID}`;
const modelID = btoa(modelURN)
var documentId = `urn:${modelID}`

window.Autodesk.Viewing.Initializer(options, async () => {
viewer = new window.Autodesk.Viewing.GuiViewer3D(contentSection);
await viewer.start();
window.Autodesk.Viewing.Initializer(options, async () => {
viewer = new window.Autodesk.Viewing.GuiViewer3D(contentSection)
await viewer.start()

viewer.setTheme("dark-theme");
viewer.setQualityLevel(false, false);
viewer.setGhosting(false);
viewer.setGroundShadow(false);
viewer.setGroundReflection(false);
viewer.setOptimizeNavigation(true);
viewer.setProgressiveRendering(true);
viewer.setTheme('dark-theme')
viewer.setQualityLevel(false, false)
viewer.setGhosting(false)
viewer.setGroundShadow(false)
viewer.setGroundReflection(false)
viewer.setOptimizeNavigation(true)
viewer.setProgressiveRendering(true)

window.Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
});
});
window.Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure)
})
})

function onDocumentLoadSuccess(doc) {
const viewable = doc.getRoot().getDefaultGeometry();
if (viewable) {
viewer
.loadDocumentNode(doc, viewable, {
applyScaling: "meters",
})
.then(async (result) => {
await InitSuperVizRoomWithAutodesk(viewer);
})
.catch((error) => {
onDocumentLoadFailure(error);
});
}
}
function onDocumentLoadFailure(error) {
console.error(`Error loading forge model: ${error}`);
}
function onDocumentLoadSuccess(doc) {
const viewable = doc.getRoot().getDefaultGeometry()
if (viewable) {
viewer
.loadDocumentNode(doc, viewable, {
applyScaling: 'meters',
})
.then(async (result) => {
await InitSuperVizRoomWithAutodesk(viewer)
})
.catch((error) => {
onDocumentLoadFailure(error)
})
}
}
function onDocumentLoadFailure(error) {
console.error(`Error loading forge model: ${error}`)
}
}

async function InitSuperVizRoomWithAutodesk(viewer) {
const room = await window.SuperVizRoom.init(DEVELOPER_KEY, {
roomId: groupId,
group: {
id: groupId,
name: groupName,
},
participant: {
id: participant.toString(),
name: "John " + participant,
avatar: {
imageUrl: `https://production.cdn.superviz.com/static/default-avatars/2.png`,
model3DUrl: `https://production.storage.superviz.com/readyplayerme/2.glb`,
},
},
});
const room = await window.SuperVizRoom.init(DEVELOPER_KEY, {
roomId: groupId,
group: {
id: groupId,
name: groupName,
},
participant: {
id: participant.toString(),
name: 'John ' + participant,
avatar: {
imageUrl: `https://production.cdn.superviz.com/static/default-avatars/2.png`,
model3DUrl: `https://production.storage.superviz.com/readyplayerme/2.glb`,
},
},
})

const autodeskPresence = new window.Presence3D(viewer, {
isAvatarsEnabled: true,
isLaserEnabled: false,
isNameEnabled: true,
avatarConfig: {
height: 0,
scale: 10,
laserOrigin: { x: 0, y: 0, z: 0 },
},
});
const autodeskPresence = new window.Presence3D(viewer, {
isAvatarsEnabled: true,
isLaserEnabled: false,
isNameEnabled: true,
avatarConfig: {
height: 0,
scale: 10,
laserOrigin: { x: 0, y: 0, z: 0 },
},
})

room.addComponent(autodeskPresence);
room.addComponent(autodeskPresence)
}

InitAutodesk();
InitAutodesk()
5 changes: 2 additions & 3 deletions js/cdn/contextual-comments-canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
"live-server": "^1.2.2"
},
"author": "",
"license": "ISC",
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
"license": "ISC"
}
5 changes: 1 addition & 4 deletions js/cdn/contextual-comments-canvas/public/projectInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export const sampleInfo = {
id: "superviz-contextual-comments-canvas-cdn-js",
name: "Contextual Comments Canvas (Cdn/JavaScript)",
};
export const sampleInfo = { id: 'superviz-contextual-comments-canvas-cdn-js', name: 'Contextual Comments Canvas (Cdn/JavaScript)' };
2 changes: 1 addition & 1 deletion js/cdn/contextual-comments-canvas/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sample for Contextual Comments HTML (Cdn/JavaScript)
# Sample for Contextual Comments Canvas (Cdn/JavaScript)

### SuperViz SDK

Expand Down
Loading

0 comments on commit dd8a307

Please sign in to comment.