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)
|
naRef f_eventGetTarget(naContext c, sc::Event& event)
|
||||||
{
|
{
|
||||||
return NasalElement::create(c, event.getTarget().lock());
|
return NasalElement::create(c, event.getTarget().lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void f_eventStopPropagation(sc::Event& event)
|
|
||||||
{
|
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave)
|
naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave)
|
||||||
{
|
{
|
||||||
NasalEvent::init("canvas.Event")
|
NasalEvent::init("canvas.Event")
|
||||||
.member("type", &sc::Event::getTypeString)
|
.member("type", &sc::Event::getTypeString)
|
||||||
.member("target", &f_eventGetTarget)
|
.member("target", &f_eventGetTarget)
|
||||||
.method("stopPropagation", &f_eventStopPropagation);
|
.method("stopPropagation", &sc::Event::stopPropagation);
|
||||||
NasalMouseEvent::init("canvas.MouseEvent")
|
NasalMouseEvent::init("canvas.MouseEvent")
|
||||||
.bases<NasalEvent>()
|
.bases<NasalEvent>()
|
||||||
.member("screenX", &sc::MouseEvent::getScreenX)
|
.member("screenX", &sc::MouseEvent::getScreenX)
|
||||||
|
@ -215,7 +201,7 @@ naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave)
|
||||||
.method("_getElementById", &f_groupGetElementById);
|
.method("_getElementById", &f_groupGetElementById);
|
||||||
NasalText::init("canvas.Text")
|
NasalText::init("canvas.Text")
|
||||||
.bases<NasalElement>()
|
.bases<NasalElement>()
|
||||||
.method("getNearestCursor", &f_textGetNearestCursor);
|
.method("getNearestCursor", &sc::Text::getNearestCursor);
|
||||||
|
|
||||||
nasal::Hash globals_module(globals, c),
|
nasal::Hash globals_module(globals, c),
|
||||||
canvas_module = globals_module.createHash("canvas");
|
canvas_module = globals_module.createHash("canvas");
|
||||||
|
|
Loading…
Add table
Reference in a new issue