From cef12d406c90750d637f56375ab151d37aaead76 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 16 Dec 2012 21:32:05 +0100 Subject: [PATCH] CanvasEvent: expose event target to Nasal --- src/Scripting/NasalCanvas.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Scripting/NasalCanvas.cxx b/src/Scripting/NasalCanvas.cxx index edd66b7fc..f682213b7 100644 --- a/src/Scripting/NasalCanvas.cxx +++ b/src/Scripting/NasalCanvas.cxx @@ -162,6 +162,11 @@ naRef f_groupGetElementById(sc::Group& group, const nasal::CallContext& ctx) ); } +naRef f_eventGetTarget(naContext c, sc::Event& event) +{ + return NasalElement::create(c, event.getTarget().lock()); +} + // TODO allow directly exposing functions without parameters and return type naRef f_eventStopPropagation(sc::Event& event, const nasal::CallContext& ctx) { @@ -175,6 +180,7 @@ naRef initNasalCanvas(naRef globals, naContext c, naRef gcSave) { NasalEvent::init("canvas.Event") .member("type", &sc::Event::getTypeString) + .member("target", &f_eventGetTarget) .method_func<&f_eventStopPropagation>("stopPropagation"); NasalMouseEvent::init("canvas.MouseEvent") .bases()