Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new lit component <extra-model> which will console.log a message when it's being added to <model-viewer> #4904

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5fde5e9
Added example to toggle between mesh variants
samaneh-kazemi Oct 24, 2023
becbd3f
Fixed the alt
samaneh-kazemi Oct 24, 2023
6ae13b7
Addressed some of the comments including changing updateAlpha and mak…
samaneh-kazemi Oct 25, 2023
9b80a3a
simplify code and address all comments
samaneh-kazemi Oct 27, 2023
817b54e
first iteration: create new lit element extra-model and log something
samaneh-kazemi Oct 17, 2024
bb31087
add the rest of the changes
samaneh-kazemi Oct 17, 2024
efcb3c1
updating format
samaneh-kazemi Oct 17, 2024
dffc2fe
ran ./node_modules/.bin/clang-format -i packages/model-viewer/src/mod…
samaneh-kazemi Oct 17, 2024
2ae714d
ran ./node_modules/.bin/clang-format -i packages/model-viewer/src/ext…
samaneh-kazemi Oct 17, 2024
c1a2dc6
first working verison
samaneh-kazemi Oct 17, 2024
9c10685
Merge branch 'master' of github.com:google/model-viewer into addlogs
samaneh-kazemi Oct 24, 2024
3d871ec
Merge branch 'addlogs' of github.com:google/model-viewer into addlogs
samaneh-kazemi Oct 24, 2024
258d097
add properties and attributes
samaneh-kazemi Oct 24, 2024
86fde43
updated method works now
samaneh-kazemi Nov 4, 2024
3414472
placeholder for unit tests
samaneh-kazemi Nov 12, 2024
e82b3d9
Merge branch 'addlogs' of github.com:google/model-viewer into addlogs
samaneh-kazemi Nov 12, 2024
aabe22a
git reset --hard origin/master
samaneh-kazemi Nov 12, 2024
2ff259f
Merge branch 'master' of github.com:google/model-viewer into addlogs
samaneh-kazemi Nov 13, 2024
40e6ecb
fix @esm-bundle issue
samaneh-kazemi Nov 13, 2024
e1f4452
Merge branch 'addlogs' of github.com:google/model-viewer into addlogs
samaneh-kazemi Nov 13, 2024
807bc8d
Merge branch 'master' of github.com:google/model-viewer into addlogs
samaneh-kazemi Nov 13, 2024
2fa0ac4
Merge branch 'addlogs' of github.com:google/model-viewer into addlogs
samaneh-kazemi Nov 13, 2024
ac18d30
updated unit tests
samaneh-kazemi Nov 13, 2024
f91f3c2
updated unit tests to make sure updated is called
samaneh-kazemi Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions packages/model-viewer/src/extra-model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { ReactiveElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import ModelViewerElementBase from './model-viewer-base.js';

/**
* Definition for a basic <extra-model> element.
*/
@customElement('extra-model')
export class ExtraModelElement extends ReactiveElement {
@property({ type: String }) src: string | null = null;

render() {
return html`<slot> </slot>`;
}

firstUpdated() {
// Get the parent <model-viewer> element
const modelViewer = this.closest('model-viewer') as ModelViewerElementBase;
if (modelViewer) {
// Add this extra model to the scene
modelViewer.addExtraModel(this);
} else {
console.error('<extra-model> must be a child of <model-viewer>');
}
}
}

declare global {
interface HTMLElementTagNameMap {
'extra-model': ExtraModelElement;
}
}

Loading
Loading