repeated calls to add_topic_commands hook

1 view
Skip to first unread message

Torsten Ziegler

unread,
Feb 1, 2011, 6:29:17 AM2/1/11
to deepamehta3
Hi Jï¿œrg and all,

I just started some new development to speed up my interaction
with the deepamehta3 canvas and created some new topics
that provide their own context_menu commands.

Doing this I found out that the add_topic_commands hook
gets called every time a topic is activated on the canvas
regardless of the type of mouse boutton and even when it is
just revealed.

Maybe you want to restrict these calls to only mouse events with the
right button for improving the performance.

Cheers,
Torsten

--
Torsten Ziegler
tor...@ziegi.de

Jörg Richter

unread,
Feb 1, 2011, 2:17:22 PM2/1/11
to deepa...@googlegroups.com

Hi Torsten,

actually the add_topic_commands hook is triggered in 2 situations:
1) when a topic is right-clicked on the canvas. See contextmenu() in canvas.js (based on oncontextmenu event; does NOT react on left-click)
In this case the commands of context "context-menu" are pulled up.
2) when the detail panel is rendered. See render_buttons() in plain_document.js
In this case the commands of context "detail-panel-show" resp. "detail-panel-show" are pulled up.

So, the add_topic_commands hook is used to provide both, the context menu items AND the detail panel's push buttons (which fire commands too). The hook-triggers you observed doesn't origin from the canvas but the detail panel. That's the intended bahavoir.

For add_topic_commands examples see deepamehta3-client's default_plugin.js and dm3_freifunk_geomap's freifunk_geomap_plugin.js

If you need any help with your application let me know.

Cheers,
Jörg


On Feb 1, 2011, at 12:29, Torsten Ziegler wrote:

> Hi Jörg and all,

Reply all
Reply to author
Forward
0 new messages