@revideo/2d 0.5.9 → 0.5.10-alpha.1094

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,9 +76,12 @@ export class Scene2D extends GeneratorScene<View2D> implements Inspectable {
76
76
  }
77
77
 
78
78
  public inspectPosition(x: number, y: number): InspectedElement | null {
79
- return this.execute(
80
- () => this.getView().hit(new Vector2(x, y))?.key ?? null,
81
- );
79
+ const node = this.getNodeByPosition(x, y);
80
+ return node?.key;
81
+ }
82
+
83
+ public getNodeByPosition(x: number, y: number): Node | null {
84
+ return this.execute(() => this.getView().hit(new Vector2(x, y)) ?? null);
82
85
  }
83
86
 
84
87
  public validateInspection(
@@ -210,6 +213,17 @@ export class Scene2D extends GeneratorScene<View2D> implements Inspectable {
210
213
  }
211
214
  }
212
215
 
216
+ public override adjustVolume(volumeScale: number) {
217
+ const mediaNodes = Array.from(this.registeredNodes.values()).filter(
218
+ (node): node is Media => node instanceof Media,
219
+ );
220
+
221
+ for (const media of mediaNodes) {
222
+ media.setVolume(media.getVolume() * volumeScale);
223
+ console.log(media.key);
224
+ }
225
+ }
226
+
213
227
  protected recreateView() {
214
228
  this.execute(() => {
215
229
  const size = this.getSize();