Setting Size of selection zone for MenuItem


#1

hi there,
I tried the toggleMenu
var Speed_menuItem = cc.MenuItemToggle.create( this, this.SpeedToggle,speedlvl1_label, speedlvl2_label, speedlvl0_label);

wherein the labels are
var speedlvl1_label = cc.MenuItemFont.create(“slide slow”);
lvl 2 being set to “slide quick” and speedlvl0 is set to “immobile”

however when on screen the zone in which the “toggling” takes place is very small and limited sort of to the first 5 letters and weirdly enough below the letters as shown on screen.

Where can I define the selection zone ? in the debuger , the content size property appears to be correct ( 30 * 80)
and browsing through the documentation, I could not find any element…
could someone please tell how is defined the bounding box (?) such that touch events are captured by this menu item ?
thanks & regards


#2

This is rect of MenuItem code:
@ rect:function () {
return cc.rect(this.*position.x - this.*contentSize.width * this.*anchorPoint.x,
this.*position.y - this.*contentSize.height * this.*anchorPoint.y,
this.*contentSize.width, this.*contentSize.height);
},@

you can set font size like this:
@ // Font Item
cc.MenuItemFont.setFontName(“Marker Felt”);
var item4 = cc.MenuItemFont.create(“I toggle enable items”, this.onMenuCallbackEnabled, this);
item4.setFontSize(20);@

these code is contain in Cocos2d-js-tests


#3

thank you I will test that tonight :slight_smile: .
1- Do you know if there is an effect to fold/unfold a layer ? I am trying to study nice effects to do with sliding sub-menu
2- I have seen the reverse nice stuff in the test. For these menu I am studying, I’d like a effect to come it (fold, bezier etc…) then wait untill the user has done its interaction and then dockaway the menu using the reverse “effect” do I use this trigger induced effect like in the tests? (I am not come that far still :slight_smile: )
thanks again