LibGDX: setScrollbarsVisible Not works - libgdx

I have a ScrollPane and I want to hide the scrollbar:
scrollPane.setScrollbarsVisible(false);
But not works!

From the docs:
setScrollbarsVisible(boolean visible)
Shows or hides the scrollbars for when using setFadeScrollBars(boolean).
You should try using it in combination with this method.

Related

no scrolling with MacBooks trackpad on (previously) animated lists

My Problem:
In my project, there is an animated container (named .uebersicht) who brings in some divs with a scrollable list. The animation flips (thanks david walsh) between two different lists in my app. Because both of them should be scrollable I have to flip and kick away the flipped container.
I have simplified my markup and CSS and made a fiddle - but the fiddle is working correct :D (maybe a good trace...) So I put it on a hosting service.
site (scrolling not working): http://fiddle.bplaced.net/52426221/
fiddel (same code, works as expected): https://jsfiddle.net/58omteyL/5/
Nevertheless, for a better understanding I visualize my problem:
(if you wonder about the different containers, they are important for the rest of the app)
My approach works well on touch and mouse interaction but the Mac trackpad (like the one in a MacBook) and maybe (could not test this) the magic pad and magic mouse on Mac are just able to scroll the container every 2nd/3rd/4th time.
It seems that Safari 12.0 under MacOS 10.13.6 tries to scroll the wrong container (window-element).
Reproduce the bug:
check out the fiddle with a MacBook/MagicPad/MagicMouse
set
your system scrolling direction to not natural
point in the yellow container and scroll down
if this works (sometimes) move and click around (inside or outside the container) and try again
It seems that there is an area in the container where scrolling never works.
Why this is a SO Question:
You could argue that this is a Safari bug and nothing for SO. But when I'm using the animations from w3css (unfortunately there is no flip) scrolling works as expected.
Hints from the Comments here
When the div is scrolled to the top and you scroll up, the focus goes to the parent and you have to lift the fingers before you are able to scroll down
My trackpad setting is not natural (swipe down = scroll down) changing these setting to natural (swipe up = scroll down, this is standard) make my example work
When scrolling is blocked you can't even scroll with js using scrollTo etc. No scrolling event is fired
The question stays the same because I can not ensure that every user has the setting to natural and not not natural like me.
I have got the bug on: MacBook Pro (15-inch, 2016)
Safari : Version 12.0 (14606.1.36.1.9)
I have added overflow: hidden to HTML, BODY and seems working.
It might be related to locking the body while scrolling but not sure.
I can test it again if you update the code by adding
html,body {
overflow:hidden
}
It's very hard to reproduce and trace properly the issue, but what it seems to work on my Mac is to add overflow:hidden; also on the other two wrappers id="item1" and class="content". In that way the only thing that remains to scroll is the div you want to scroll. I think it could be worth to give it a try.
MacBook Pro (Retina, 15-inch, Early 2013) - OS 10.14.1 -
Safari version Version 12.0.1. - trackpad natural and not not natural
Hope this help.
Finally after a few good comments here I found a solution but it is more likely a workaround (thanks for your input).
I played around with some eventListeners, capturing and bubbling. It seems that the scrolling goes down to the scroll element (capture) but is not bubbling up again. Listen to the scroll event and scroll via JS in the right direction until DOM is unblocked was getting to complicated. But if I modify the style (position/size) of the scrolling element .styleWrap .scrollable the blocking was gone !
After that it turns out that it prevents Safari from any blocking when I modify this element after the animation was finished.
So my workaround is to make a style change and revert that after the CSS animation has been finished - and voilĂ  :
function slide(slideName){
// scroll to top
scroll(0,0);
// show the Slide
var slideElement = document.getElementById(slideName);
slideElement.classList.add('show');
}
setTimeout(function(){
slide('item1');
// make a change to be able to revert this change
var scrollDiv = document.querySelector(".scrollable");
scrollDiv.style.top = "1px";
// change some style (reset the prev. change)
setTimeout(function(){
document.querySelector(".scrollable").style.top = "";
}, 1300 + 10); // CSS animation time + 10ms
}, 100);
Maybe this is the reason why the w3css animation does not lead into blocking...
You can test it here (I add more px to the topto make it more visible here): http://fiddle.bplaced.net/52426221g/
I'm not 100% satisfied with this solution because:
it is a CSS problem solved with JS
you need to know the animation timings (which can change with design)
Therefore I would like to change the accepted answer if there is a CSS solution

Redraw select menu in JQuery Mobile

I am trying to make a JQuery Mobile select menu button larger by changing the data-mini property from true to false on the fly. I am able to change the property, but the select menu does not redraw.
It works with a button, by using .buttonMarkup({mini: false}) (which redraws the button instantly), but as far as I know there is no equivalent for select menus.
I have tried .selectmenu("refresh") and .change() - neither redraws the select menu button.
Here is an illustration of the problem: http://jsfiddle.net/YYXuZ/
Does anyone have a solution?
Hey this works for me -
$('#testselectmenu').parent('div').addClass('ui-fullsize');
jsFiddle Demo
I noticed you won't need the $('#testselectmenu').selectmenu('refresh'); with this approach.
/Update
To play it safe I would do this (it does the same thing while removing the data-mini attribute and ui-mini class) -
$('#testselectmenu').parent('div').attr('data-mini', 'false').removeClass('ui-mini').addClass('ui-fullsize');
I think jQM should handle this automatically when you call a .selectmenu('refresh'), I'm not sure why it doesn't.

Setting JQueryMobile Popup's data-position using JavaScript

$('#popupDiv').popup("open");
This programmatically opens a JQueryMobile pop up, but I want to know if it is possible to change or set my popup's settings, such as data-position and data-transition along with my code above. Thanks.
You can do:
$('#popupDiv').popup("open", {positionTo: '#mydiv'});
'origin' is not working for me in version 1.2 though.
see: http://jquerymobile.com/demos/1.2.0/docs/pages/popup/methods.html
Straight from the jQuery Mobile Docs:
Positioning options By default, popups open centered vertically and
horizontally over the thing you clicked (the origin) which is good for
popups used as tooltips or menus. The framework also applies some
basic collision detection rules to ensure that the popup will appear
on-screen so the ultimate position may not always be centered over the
origin.
For situations like a dialog or lightbox where the popup should appear
centered within the window instead of over the origin, add the
data-position-to attribute to the link and specify a value of window.
It's also possible to specify any valid selector as the value of
position-to in addition to origin and window. For example, if you add
data-position-to="#myElement" the popup will be positioned over the
element with the id myElement.
<a href="#positionWindow" data-rel="popup" data-position-to="window" data-transition="slideup">
<div data-role="popup" id="positionWindow">
<p>I am positioned to the window.</p>
</div>
You can add data-transition="slideup" (or the transition of your choice) to the link, as well as other positioning options outlined in the docs link at the top of my answer.
yeah the right way to do this is use event.target like this
$('#popup').off('taphold').on('taphold', function (e) {
$('#popupDiv').popup("open", e.target);
});
incidentally, this code then places a popup if you tap hold the button and a click event is like this would mean a normal click still works
$('#popup').on('tap', function (){
var url = $(this).attr('url');
window.open( url, '_parent');
});
nb: I added "url='google.com'" to the markup and made href='#'

Adobe air mobile - softKeyboardType is not working when using skinClass to allow scrolling?

I am trying to set the softKeyboardType to email but when ever i use skinClass="spark.skins.mobile.TextAreaSkin" it doesn't change it but when i take off skinClass="spark.skins.mobile.TextAreaSkin" it does work. The problem is i need the skinClass="spark.skins.mobile.TextAreaSkin" class to allow my application so scroll with out it the text does not stay with in the bounds of the text input boxes. Has anyone seen this problem or another fix the the scrolling problem?
Code examples
<s:TextInput softKeyboardType="email" id="id1" width="100%" skinClass="spark.skins.mobile.TextInputSkin" />
<s:TextArea softKeyboardType="email" id="id2" height="400" width="100%" skinClass="spark.skins.mobile.TextAreaSkin" />
Thank for the help,
Justin
I've checked mobiletheme default.css in flex 4.6 sdk
adobe is using different skins for TextInput and TextArea components
TextArea
{
...
skinClass: ClassReference("spark.skins.mobile.StageTextAreaSkin");
}
TextInput
{
...
skinClass: ClassReference("spark.skins.mobile.StageTextInputSkin");
}
so I think you should use StageTextAreaSkin or StageTextInputSkin as a skinClass for corresponding components
softKeyboardType will work in this case but text position problem will stay, I think you will need to change/fix StageTextAreaSkin or StageTextInputSkin sources for your scrolling
Confronted with this issue, I came up with a workaround which worked in my case.
Use default skin, set your softKeyboardType.
While doing layout for your screen, create a section which contains the uppermost part of your screen and which you can easily collaps or toggle its includeInLayout property, so when you do that, it will make your TextInput or TextArea to appear over the keyboard, bypassing the scroller for that purpose.
Then, when your field receives focus, in focusIn handler, you collaps or toggle this section. This does two good things: first, it lifts your field over the keyboard, and second, it removes focus from your field (at least in my case it did, not sure 100%, if it doesn't, then shift focus manually). This is good because when you set focus on your field once again (yourfield.setFocus()), the cursor will appear where you want it, within the bounds of your field.
Once done typing, you restore top section to its original state from focusOut or softKeyboardDeactivate handlers.
Hope this helps...
seems like it's flex 4.6 bug
http://forums.adobe.com/message/4122095

html5 drag and drop drag anything opacity

I am using html5 drag and drop to drag and drop div elements. On the dragstart event I set the the opacity of the div element to 0.4 which reduces makes the div element lighter but it is not transparent ie. when I drag the div element over other div elements I can't see the elements in the background.
var cols = document.querySelectorAll('.draggablediv');
[].forEach.call(cols, function(col) {
col.addEventListener('dragstart', function (e) {this.style.opacity =
'0.4'; return true;}, false); });
I am using chrome 17.0.963.56.
Edit Note: This does not happen in firefox
Any ideas?
Thanks
There is a tutorial that features the same code you are using at:
http://www.html5rocks.com/en/tutorials/dnd/basics/
If you load the link above in Firefox, you'll notice the examples do not work. The tutorial features a specific mention of Firefox and why the examples don't work - you'll need to "wire up" the dataTransfer object.