Adjusting qooxdoo scrolling speed/sensitivity - qooxdoo

I'm wondering if it is possible to adjust the scrolling sensitivity in qooxdoo applications using qx.ui.container.Scroll or any internally scrollable components, e.g. qx.ui.table.Table.
What I'm experiencing on my MacBook Pro running Sierra 10.12.3 is a blazing fast scrolling speed using the trackpad, and it only appears to be the case in qooxdoo-based applications which makes them very difficult to use. Tried different browsers with comparable results (Chrome, Safari, ...).
As an example, open the API browser and scroll the browsing API tree on the left.

Qooxdoo does some efforts to normalize mouse wheel delta across browser platforms. The two finger swipe gestures on the trackpad in OSX seem to be exposed as wheel events to safari, which may not be optimally normalized. Mouse wheel events caused by turning a real mouse wheel do not seem to cause that blazing scrolling speed.
The code where normalization happens is located at https://github.com/qooxdoo/qooxdoo/blob/master/framework/source/class/qx/util/Wheel.js
The normalization routines are not exposed as an API and are not configurable. To solve this issue the normalization code needs to be adjusted.
It would be best to open an issue for this in the github issue tracker at https://github.com/qooxdoo/qooxdoo/issues
Here is a jsfiddle which writes the event type and delta down to the console for mouse wheel events. This may be a starting point for investigating the delta values of wheel events on different platforms:
http://jsfiddle.net/mfe8J/77/
function wheelSpeed(event) {
var delta;
if (event.wheelDelta) {
delta = event.wheelDelta;
} else {
delta = event.deltaY ? event.deltaY : event.detail;
}
console.log("event type: "+ event.type + ", delta: " + delta);
return delta;
}
window.addEventListener('mousewheel', wheelSpeed);
window.addEventListener('wheel', wheelSpeed);
A proposal for a solution or best a pull request which solves the issue would be greatly appreciated and welcome.

Related

Simulate a mouse click with IOKit

Backstory:
I want to write a C program to automate clicks in a program running in OSx (in a desktop setting).
I first tried Using Quartz Event Services to simulate input events. But then I had this problem: Simulating mouse clicks on Mac OS X does not work for some applications, and the answers didn't help in my case.
CGEventRef click1_down = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, CGPointMake(posx, posy), kCGMouseButtonLeft);
CGEventSetIntegerValueField(click1_down, kCGMouseEventClickState, 0);
// This down click works about 5% of the time.
CGEventPost(kCGHIDEventTap, click1_down);
usleep(30000);
CGEventRef click1_up = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseUp, CGPointMake(posx, posy), kCGMouseButtonLeft);
CGEventSetIntegerValueField(click1_up, kCGMouseEventClickState, 1);
CGEventPost(kCGHIDEventTap, click1_up);
// I've tried every combination of CGEventSetIntegerValueField, usleep and CFRelease, nothing seems to help
// The only thing helping is repeating the line: "CGEventPost(kCGHIDEventTap, click1_down);" 100s of times,
// then the down click works about 80% of the time, still not acceptable
I'm now turning to solution #3 suggested here: How can Mac OS X games receive low-level keyboard input events?
(this might also help How can I simulate the touch events by IOHIDEvent?)
I tried with Karabiner by sending a mouse click on key press:
<item>
<name>Right Mousebutton</name>
<identifier>rightMouseButton</identifier>
<autogen>__KeyToKey__ KeyCode::H, PointingButton::LEFT</autogen>
</item>
And this sends the click 100% of the time, but I want to send the click with by writing C code (to have greater control). Tough I'm not sure, Karabiner seems to use IOKit to send events, so I think this should work in my case, if I'm able to send mouse events with IOKit.
So my question is basically: how do I write a C program to simulate a mouse left click with IOKit ? The documentation is very sparse and I didn't manage to do it.
I tried getting inspiration from some projects:
https://github.com/tekezo/Karabiner
https://github.com/NoobsArePeople2/manymouse

Best open-source grid with smooth, infinite scrolling

When I started working on my current project I was given quite an arduous task - to build something that in essence suppose to replace big spreadsheet people use internally in my company.
That's why we I thought a paginated table would never work, and quite honestly I think pagination is stupid. Displaying dynamically changing data on a paginated table is lame. Say an item on page #2 with next data update can land on page whatever.
So we needed to build a grid with nice infinite scroll. Don't get me wrong, I've tried many different solutions. First, I built vanilla ng-repeat thing and tried using ng-infinite-scroll, and then ng-scroll from UI.Utils. That quickly get me to the point where scrolling became painfully slow, and I haven't even had used any crazy stuff like complicated cell templates, ng-ifs or filters. Very soon performance became my biggest pain. When I started adding stuff like resizable columns and custom cell templates, no browser could handle all those bindings anymore.
Then I tried ng-grid, and at first I kinda liked it - easy to use, it has a few nice features I needed, but soon I realized - ng-grid is awful. Current version stuffed with bugs, all contributors stopped fixing those and switched to work on a next version. And only God knows when that will be ready to use. ng-grid turned out to be pretty much worse than even vanilla ng-repeat.
I kept trying to find something better. trNgGrid looked good, but way too simplistic and doesn't offer features I was looking for out of the box.
ng-table didn't look much different from ng-grid, probably it would've caused me same performance issues.
And of course I needed to find a way to optimize bindings. Tried bind-once - wasn't satisfied, grid was still laggy. (upd: angular 1.3 offers {{::foo}} syntax for one-time binding)
Then I tried React. Initial experiment looked promising, but in order to build something more complicated I need to learn React specifics, besides that thing feels kinda non-anguleresque and who knows how to test directives built with angular+react. All my efforts to build nice automated testing failed - I couldn't find a way to make React and PhanthomJS to like each other (which is probably more Phantom's problem. is there better headless browser) Also React doesn't solve "appending to DOM" problem - when you push new elements into the data array, for a few milliseconds browser blocks the UI thread. That of course is completely different type of problem.
My colleague (who's working on server-side of things) after seeing my struggles, grumbled to me that I already spent too much, trying to solve performance problems. He made me to try SlickGrid, telling me stories how this is freakin zee best grid widget. I honestly tried it, and quickly wanted to burn my computer. That thing completely depends on jQuery and bunch of jQueryUI plugins and I refuse to suddenly drop to medieval times of web-development and lose all angular goodness. No, thank you.
Then I came by ux-angularjs-datagrid, and I really, really, really liked it. It uses some smart bad-ass algorithm to keep things very responsive. Project is young, yet looks very promising. I was able to build some basic grid with lots of rows (I mean huge number of rows) without straying too much from the way of angular zen and scrolling still smooth. Unfortunately it's not a complete grid widget solution - you won't have resizable columns and other things out of the box, documentation is somewhat lacking, etc.
Also I found this article, and had mixed feelings about it, these guys applied a few non-documented hacks to angular and most probably those would breaks with feature versions of angular.
Of course there are at least couple of paid options like Wijmo and Kendo UI. Those are compatible with angular, however examples shown are quite simple paginated tables and I'm not sure if it is worth even trying them. I might end-up having same performance issues. Also you can't selectively pay just for the grid widget, you have to buy entire suite - full of shit I probably never use.
So, finally to my question - is there good, guaranteed, less painful way to have nice grid with infinite scrolling? Can someone point to good examples, projects or web-pages? Is it safe to use ux-angularjs-datagrid or better to build my own thing using angular and react? Anybody ever tried Kendo or Wijmo grids?
Please! Don't vote for closing this question, I know there are a lot of similar questions on stackoverflow, and I read through almost every single one of them, yet the question remains open.
Maybe the problem is not with the existing widgets but more with the way you use it.
You have to understand that over 2000 bindings angular digest cycles can take too long for the UI to render smoothly. In the same idea the more html nodes you have on your page, the more memory you will use and you might reach the browser capacity to render so many nodes in a smooth way. This is one of the reason why people use this "lame" pagination.
At the end what you need to achieve to get something "smooth" is to limit the amount of displayed data on the page. To make it transparent you can do pagination on scroll.
This plunker shows you the idea, with smart-table. When scrolling down, the next page is loaded (you will have to implement the previous page when scrolling up). And at any time the maximum amount of rows is 40.
function getData(tableState) {
//here you could create a query string from tableState
//fake ajax call
$scope.isLoading = true;
$timeout(function () {
//if we reset (like after a search or an order)
if (tableState.pagination.start === 0) {
$scope.rowCollection = getAPage();
} else {
//we load more
$scope.rowCollection = $scope.rowCollection.concat(getAPage());
//remove first nodes if needed
if (lastStart < tableState.pagination.start && $scope.rowCollection.length > maxNodes) {
//remove the first nodes
$scope.rowCollection.splice(0, 20);
}
}
lastStart = tableState.pagination.start;
$scope.isLoading = false;
}, 1000);
}
This function is called whenever the user scroll down and reach a threshold (with throttle of course for performance reason)
but the important part is where you remove the first entries in the model if you have loaded more than a given amount of data.
I'd like to bring your attention towards Angular Grid. I had the exactly same problems as you said, so ended up writing (and sharing) my own grid widget. It can handle very large datasets and it has excellent scrolling.

overlapped ccsprites doesnt responds touch events albeit z-order is bigger

CCBigSprite and CCSmallSprite classes are inherited from CCSprite.
spr1,spr2 are instances of them.
All ccTouchesStart,ccTouchesMove,ccTouchesEnd methods overridden from protocol CCTargetedTouchDelegate
for both classes.
problem :in normal cases,touch events working as expected and works good for any sprite instances,
till sprites overlaps.
Touch events works for (CCBigSprite *spr1) if (CCSmallSprite *spr2) is touched.
Because of an overlap issue here and exact position as image shown.
when I press spr2 its touch events should work instead of sp1.
how can I fix this fatal problem ?
both classes have this overridden method same :
-(void)onEnter {
[super onEnter];
[[[CCDirector sharedDirector]touchDispatcher]addTargetedDelegate:self
priority:self.touchPriority swallowsTouches:YES];
}
does it sense ?
also:
setPriority didnt change anyhing.
Im changing manually.
[spr2 setTouchPriority:1];[spr1 setTouchPriority:2];//lower meant to be highest priority
or vise versa.
didnt help.
this shall be a cocos2d-iphone 2.0 stable version issue ?
The draw order does not influence the order of touch events.
If you tap on small sprite in the above image, only the order the sprites registered themselves with CCTouchDispatcher determines whether small or big sprite receives the first touch events.

Silverlight MediaElement Position with generated WAV (performance)

I have tied a MediaElement control to a Slider control.
I am getting my stream from a binary field in a SQL Server database.
I am concerned that there may be some performance issues due to the following:
1. I am storing a byte array that is being retrieved from a web service
2. Anytime I do anything with the MediaElement (i.e. reset position, stop playback, resume playback) I have to reset the source of the MediaElement
The code I am using to set the position is as follows:
private void ResetPlayerWithPosition(double milliseconds = 0)
{
// _wmss is a WaveMediaStreamSource from WAVMss.dll
// audio is of type byte[]
this._wmss = new WaveMediaStreamSource(new MemoryStream(this.audio));
this.playbackController.SetSource(this._wmss);
this.playbackController.MediaOpened += (s, e) =>
{
this.playbackController.Position = TimeSpan.FromMilliseconds(milliseconds);
};
}
My concern is that if the file gets to be large, there will be performance degradation in that the code has to wait for the file to be loaded into the MediaElement's source before the position is reset. If this is the case, does anyone have any suggestions as to how I could make it a bit more efficient?
Thanks in advance for any suggestions.
It's been 1 year 10 months 14 days since I first posted this, and not even a comment or follow-up question. In this time, iOS has made many advancements, Android has released some new flavors, HTML5 and jQuery have matured gracefully, and Microsoft has abandoned Silverlight for Metro.
I have abandoned this solution since support is sparse and on its way to nonexistence. In exchange for Silverlight, I have opted for a HTML5 + jQuery solution. This has enabled me to develop a light weight, Web Method driven, AJAX enabled, browser + device + server independent, cross-platform client in a reduced development time with more flexibility, sustainability, and maintainability.
Silverlight: Another highly innovative yet grossly inefficient technology laid to rest. RIP.

No Swipe TouchGesture in touchEvent?

I didn't find any similar posts when searching previous questions.
I am developing a game in MIDP for Blackberry Storms. I am using a BlackBerryGameCanvas and using the callback function touchEvent. As an argument, I'm getting an instance of TouchEvent But I want to listen for a TouchGesture like Swipe. But after doing swipe in simulator touch screen I am getting null as result:
public void touchEvent(TouchEvent message) {
TouchGesturenow = message.getGesture();
//always getting null as a result
//according to API when user does not perform any gesture
//operation then it would return null otherwise reference
//but here I have performed a swipe gesture then also it is returning null.
}
If it is not possible at all then I have to use
getMovePoints(int touch, int[] x, int[] y, int[] time) ..and some calculation .
Can anybody confirm for me: does Swipe TouchGesture not work with Blackberry Storm?
Per answer in other SO discussion, simulation of swipe gestures for BB Storm seems to be quite complicated: Blackberry Storm Emulator - TouchGesture events not firing, how to get a Swipe to work?.
Most likely reason for getting null (meaning "this event is not a gesture" per BlackBerry API) is that you just didn't do swipe in simulator touch screen well enough for emulator to recognize it as swipe.
I am developing a game in MIDP for Blackberry Storms.
For the sake of precision - TouchGesture has nothing to do with MIDP - there's simply no such thing in MIDP 2 API. Nor there is touchEvent in MIDP API.
All the API and features you use appear BlackBerry-specific: BlackBerryGameCanvas, TouchEvent etc. Again, this issue in general has nothing to do with MIDP .

Resources