Jssor - arrow key navigation - jssor

Can I use jssor slider along with fullPage slider:
http://alvarotrigo.com/fullPage/#secondPage/1
Can I use up/down arrow keys for the navigation when drag orientation is set to vertical (2) ?

Here is an example, http://www.jssor.com/testcase/full-screen-slider-new-api.source.html
And you can call $Prev, $Next api when you detect key press of up/down.
//call $Prev while 'up' keypress event fires
jssor_slider1.$Prev();
//call $Next while 'down' keypress event fires
jssor_slider1.$Next();

Related

gtkmm Gtk::Layout negative child position not setting its absolute position

The description of Gtk::Layout says
Infinite scrollable area containing child widgets and/or custom drawing
I put a Gtk::Layout inside a Gtk::ScrolledWindow, gave the Gtk::Layout a size of 400x400 and then placed a Gtk::Button at (450, 450), but the scrollbars only appeared until the scrolled window was resized to 400x400, not (450+button-width x 450+button-height). So I had to move the bottom-right corner of the layout by connecting a handler to button's signal_size_allocate() signal and manually call Gtk::Layout::set_size() function to resize it up to button's boundary. Now the scrolled window shows scrollbars to reach the button. Up to this everything was OK.
class LayoutWindowTest : public ApplicationWindow {
ScrolledWindow sw;
Layout l;
Button b;
public:
LayoutWindowTest()
: l(), b("test") {
set_title("layout test");
set_size_request(400, 400);
sw.set_hadjustment(l.get_hadjustment());
sw.set_vadjustment(l.get_vadjustment());
l.set_size(400, 400);
sw.add(l);
add(sw);
// b.get_allocation() won't work because button has not been allocated a
// size yet
b.signal_size_allocate().connect(
[this](Allocation& btn_sz) {
l.set_size(btn_sz.get_x() + btn_sz.get_width(),
btn_sz.get_y() + btn_sz.get_height());
});
l.put(b, 450, 450);
show_all_children();
}
virtual ~LayoutWindowTest() {}
};
Initial window showing scrollbars and then scrolled to bottom-right corner to show button
Now I need to do the same thing for the top-left corner, i.e. put the button out of visible boundary of scrolled window and then use the scrollbars to reach the button. I tried putting the button at (-10, -10), but unlike the previous case I can't set layout's top-left corner with code by resizing it, so can't move the layout's scrollbars. When I resize the scrolled window manually by its top-left corner the button moves towards top-left with it instead of staying there. How to remedy this situation?
Initial window with button at (-10, -10) and no scrollbars, tried resizing the window by top-left handle but button moves with it
In short, how can I scroll in both top-left and bottom-right directions infinitely?

Change sprite on mouseover

I have a sprite that acts as a button in the main menu of my game. It has a box collider, and I use OnMouseDown() to register clicks of the button.
I want to make the sprite change when my mouse rolls over the button. I know I can do stuff using the function OnMouseOver() but how do I switch between 2 sprites completely?
You don’t need to use two sprites and switch between them. Just use an effect like this one:
void OnMouseOver()
{
transform.GetComponent<SpriteRenderer>().sprite.color = "your new color for clicking effect";
transform.GetComponent<SpriteRenderer>().sprite.localScale -= new Vector3(0.1f, 0.1f, 0.1f);
}
and get back all this proccess in OnMouseExit. Or, if you still want to change sprite, you can change it like so:
Sprite sprite;
Sprite highlightSprite;
void OnMouseOver()
{
transform.GetComponent<SpriteRenderer>().sprite = highlightSprite;
}
void OnMouseExit()
{
transform.GetComponent<SpriteRenderer>().sprite = sprite;
}
and change back in OnMouseExit.
put the mouse functions onto an empty parent GameObject, and parent it to all of the sprites you want, then just enable/disable them via the parent
Other options:
Use worldspace UI button instead (then you can use the built-in spriteswap transition and other button methods : http://docs.unity3d.com/Manual/script-SelectableTransition.html )
Add public Sprite variable and assign mouseover sprite to that, then in OnMouseOver() use that sprite image in your button sprite. (and revert back to original sprite on mouse out)
Could also use Mecanim animation, OnMouseOver() toggle to another animation (which only has 1 frame)

Position a UI button on bottom left of the viewport/screen?

How do I place a UI Button (the new UI) so that it is always at the bottom-left on the screen/viewport? My idea was to do it in code like this:
void Awake () {
fireButton.transform.position = new Vector3(Screen.width - 50, Screen.height - 50, 0);
}
It is not working at all. How can I best do this?
Instead of doing it in code, click on the UIButton in the scene or hierarchy then go into the inspector and in the top left of the transform component you will see a square, click it, hold shift and alt and then click the 'Bottom Left' square to latch it to that side of the screen.

How to change the mouse cursor icon type when mouse moves out of client area ( propertysheet)?

I got stuck with an issue in property sheet .I want to load different cursor when the mouse position is within the client area and load another when moves out of the client area.
In the porpetysheet I added four page. In the first page when I click next I am loading cursor of IDC_WAIT type and loading IDC_ARROW when the mouse moves out of the client area.
In the page class I triggered the event for WM_MOUSEMOVE as follow:
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
if(TRUE == m_bIsNextBtnClicked)
::SetCursor(LoadCursor(NULL, IDC_WAIT));
else
::SetCursor(LoadCursor(NULL, IDC_ARROW));
return TRUE;
}
This event is getting triggered and absolutely had no issue with this. Similarly I tried adding MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) this event making an assumption that this will get triggered if the mouse moves out of the client area, but this event did not get triggered at all.If this is not the mouse event to be triggered for mouseleave which event should I trigger?
LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
::SetCursor(LoadCursor(NULL, IDC_ARROW));
return TRUE;
}
Now when I click Next button , I was actually calling a function which is taking sometime to return . Before to this function I am loading IDC_WAIT cursor i.e.,
::SetCursor(LoadCursor(NULL, IDC_WAIT)); .
Now when move the mouse cursor on to the non-client area I want to load IDC_ARROW cursor i.e.,
::SetCursor(LoadCursor(NULL, IDC_ARROW));
When the moves on to the non-client area I am handling the mouse event in sheet derived class as follows,
MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnNCMouseMove)
LRESULT OnNCMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
::SetCursor(LoadCursor(NULL, IDC_ARROW));
return 0;
}
This event is not getting triggered until unless the function in the Next button event is executed.
I want both of them to be done in parallel i.e, click Next button now hover mouse on the client area, Busy icon should come and when mouse moves out of the client area then IDC_ARROW icon should come.
LRESULT OnWizardNext()
{
::SetCursor(LoadCursor(NULL, IDC_WAIT));
m_bIsNextBtnIsClicked = TRUE;
BOOL bRet = MyFun();
m_bIsNextBtnIsClicked = FALSE;
//Until this function is executed **WM_NCMOUSEMOVE**
//event is not getting triggered.But this event should get triggered and I
//should be able to see the change of cursor within and out of client area.
}
Can anyone kindly help me to solve this issue.
As stated on the MSDN version of this question # here it's not good design to involve the user interface thread in a long operation, a progress bar that is updated from another thread would give more feedback to the user.

How to differentiate between hold click and drag in Phaser?

How to know the distance of the Drag, unused PositionUP or onInputUp to differentiate a drag from a long click?
http://i.stack.imgur.com/FvVsN.pnghttp://www.html5gamedevs.com/uploads/monthly_07_2014/post-9642-0-48696600-1405440289.png
it is a some code:
var fnd = game.add.group();
var o = fnd.create(game.world.randomX, game.world.randomY, 'fon');
o.events.onDragStart.add(this.DragActivo, this);
DragActive = function (image) {
//When something has been moved is drag but when something has been pressed for long time is clicked
};
You can use the property sprite.input.dragDistanceThreshold = 3; in order to start dragging only if the pointer moves a minimum amount of pixels when after onInputDown.
Here's the doc
I solved my problem that you have to do something like this.
I used the function mouseup and inside this one I placed the mousemove to recognize when the mouse moves it is a drag, if it does not do it is a very long click
because this framework does not have