NasalCanvas: clean up
This commit is contained in:
parent
0587db3b1e
commit
664cb474e1
1 changed files with 2 additions and 16 deletions
|
@ -164,31 +164,17 @@ naRef f_groupGetElementById(sc::Group& group, const nasal::CallContext& ctx)
|
|||
);
|
||||
}
|
||||
|
||||
naRef f_textGetNearestCursor(sc::Text& text, const nasal::CallContext& ctx)
|
||||
{
|
||||
return nasal::to_nasal
|
||||
(
|
||||
ctx.c,
|
||||
text.getNearestCursor( ctx.requireArg<osg::Vec2>(0) )
|
||||
);
|
||||
}
|
||||
|
||||
naRef f_eventGetTarget(naContext c, sc::Event& event)
|
||||
{
|
||||
return NasalElement::create(c, event.getTarget().lock());
|
||||
}
|
||||
|
||||
void f_eventStopPropagation(sc::Event& event)
|
||||
{
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave)
|
||||
{
|
||||
NasalEvent::init("canvas.Event")
|
||||
.member("type", &sc::Event::getTypeString)
|
||||
.member("target", &f_eventGetTarget)
|
||||
.method("stopPropagation", &f_eventStopPropagation);
|
||||
.method("stopPropagation", &sc::Event::stopPropagation);
|
||||
NasalMouseEvent::init("canvas.MouseEvent")
|
||||
.bases<NasalEvent>()
|
||||
.member("screenX", &sc::MouseEvent::getScreenX)
|
||||
|
@ -215,7 +201,7 @@ naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave)
|
|||
.method("_getElementById", &f_groupGetElementById);
|
||||
NasalText::init("canvas.Text")
|
||||
.bases<NasalElement>()
|
||||
.method("getNearestCursor", &f_textGetNearestCursor);
|
||||
.method("getNearestCursor", &sc::Text::getNearestCursor);
|
||||
|
||||
nasal::Hash globals_module(globals, c),
|
||||
canvas_module = globals_module.createHash("canvas");
|
||||
|
|
Loading…
Reference in a new issue