avm2: Stub `getObjectsUnderPoint` and `areInaccessibleObjectsUnderPoint` as we do not yet support the `Point` class

This commit is contained in:
David Wendt 2020-11-14 16:09:41 -05:00 committed by Mike Welsh
parent fec4e3c0a9
commit 6cb3ff9632
1 changed files with 29 additions and 0 deletions

View File

@ -553,6 +553,24 @@ pub fn stop_all_movie_clips<'gc>(
Ok(Value::Undefined) Ok(Value::Undefined)
} }
/// Stubs `DisplayObjectContainer.getObjectsUnderPoint`
pub fn get_objects_under_point<'gc>(
_activation: &mut Activation<'_, 'gc, '_>,
_this: Option<Object<'gc>>,
_args: &[Value<'gc>],
) -> Result<Value<'gc>, Error> {
Err("DisplayObjectContainer.getObjectsUnderPoint not yet implemented".into())
}
/// Stubs `DisplayObjectContainer.areInaccessibleObjectsUnderPoint`
pub fn are_inaccessible_objects_under_point<'gc>(
_activation: &mut Activation<'_, 'gc, '_>,
_this: Option<Object<'gc>>,
_args: &[Value<'gc>],
) -> Result<Value<'gc>, Error> {
Err("DisplayObjectContainer.areInaccessibleObjectsUnderPoint not yet implemented".into())
}
/// Construct `DisplayObjectContainer`'s class. /// Construct `DisplayObjectContainer`'s class.
pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> { pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>> {
let class = Class::new( let class = Class::new(
@ -624,6 +642,17 @@ pub fn create_class<'gc>(mc: MutationContext<'gc, '_>) -> GcCell<'gc, Class<'gc>
QName::new(Namespace::public_namespace(), "stopAllMovieClips"), QName::new(Namespace::public_namespace(), "stopAllMovieClips"),
Method::from_builtin(stop_all_movie_clips), Method::from_builtin(stop_all_movie_clips),
)); ));
write.define_instance_trait(Trait::from_method(
QName::new(Namespace::public_namespace(), "getObjectsUnderPoint"),
Method::from_builtin(get_objects_under_point),
));
write.define_instance_trait(Trait::from_method(
QName::new(
Namespace::public_namespace(),
"areInaccessibleObjectsUnderPoint",
),
Method::from_builtin(are_inaccessible_objects_under_point),
));
class class
} }