Zoom with Ctrl+Scroll Wheel in Electron App? - electron

Is it possible to emulate browser-like behavior in Electron to add zooming with ctrl+scroll wheel?

Yes, it should be possible to emulate that behavior:
Catch the CTRL + mousewheel element as discussed in this question.
Use the Electron web-frame API to adapt the zoomFactor accordingly, use webFrame.getZoomFactor() to get the current zoom level and webFrame.setZoomFactor(level) to change it.

Related

Flex 4 - Set focus to none

I'm building an Away3d application which uses Flex 4.6 for UI. The arrow keys are required to move the 3d components - however, after using a component such as a slider, the application gives it focus, which means the arrow keys control it.
I can't find any way to set the global application focus to nothing - is there an easy way to do this?
I've tried setting the application's focusManager.setFocus(new Button()), and null (which crashes it), I'm sure it's easy but I can only find advice on how to set the focus to a component, not set it to nothing.
Thanks in advance!
Perhaps try listening for a mouseup event on the slider then force the focus back to the 3d component with something like:
focusManager.setFocus(3dcomponent);

iOS Mobile Safari scrolling: DOM manipulation while decelerating?

In iOS MObile Safari, after flicking to scroll, is it possible to manipulate the DOM while the system is in deceleration mode? I tested this by constantly incrementing a number in a fix-positioned element on the page using setInterval and I noticed the DOM doesn't update when scrolling. Is there any way to do this?
No. If you want to run javascript in response to scrolling, your only solution is to use programmatic scrolling (iScroller, zynga-scroller).

How do I hide (but not disable) scrollbars on iPad while scrolling?

I am working with the iPad (mobile safari):
Question:
Does anyone know how to hide the scrollbars on iPad?
I have looked already looked into webkit scrollbar styling using ::-webkit-scrollbar... This does not work for the main windows scrollbars.
Scenario:
I have an repeating image inside of a div that is over 10,000px by 10,000px. I want the user to be able to swipe the screen to move around over this huge div, which is essentially one big image, WITHOUT the scrollbars showing up.
So I need the functionality of the scrollbars, I just need them to be hidden.
Suggestions?
Thanks for your help!
-slwd
You might be able to use the TouchScroll library: http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/
Otherwise, what I would do is set overflow: hidden on your div and then use JavaScript to implement the scrolling. This will require listening for touchstart, touchmove, and touchend events, and moving the x/y position of your image accordingly. If you need frictional slowing (similar to what's built into scrolling views on mobile Safari) you can implement that as well. Keep track of the dx/dy between touchmove events, use that as a starting velocity for when you receive a touchend, then use setInterval as a timer to apply the friction until some minimum threshold at which you stop the animation.
This is sort of a hack, but: Make your UIWebView about 10px taller and wider than the screen.
(Inspired by someone asking the opposite question.)

How to enable iframe scrollbar on iOS safari

I am trying to implement facebook's live stream plugin on my website. I see that there is a scrollbar on pc and mac browsers, but not on iphone or ipad safari. I think it is because iphone and ipad treat scrollbar differently since they are both touch based devices. So I expect to scroll iframe with two fingers, but it does not work either.
Here is sample page (used a different src url) http://para.qacode.com/test.php
How do I enable two finger scrolling or normal scrollbar on ios safari?
On iOS versions prior to 5, you can scroll iframes on iPad/iPhone using two fingers, but this is a bit of a hidden feature and most people don't know about it. I'm not sure why tow-finger scrolling isn't working for your iframe - perhaps there is some JavaScript intercepting the touch event?
On iOS 5 this has been fixed and scrolling works as expected for iframes with one finger.
If you need to scroll a sub-region of the page on iOS 4 and earlier, the best bet is to use a library such as iScroll that implements scrolling with JavaScript touch-event handling.
Apply these styles to the parent container:
-webkit-overflow-scrolling:touch;
overflow:auto;

Mouse movement / mouseover and JavaScript evaluation in watir

I have a JavaScript-heavy Rails app which I am testing in watir. I have two specific testing requirements:
I need to be able to simulate moving the mouse to a specific area of the screen (or at least triggering the onmouseover event for a div)
Evaluating a snippet of JavaScript once the above has happened to see if a flag is set correctly
I haven't been able to figure out how to do this in watir. Any ideas on how to do this?
For the first question:
browser.div(:id, "some-id").fire_event "onmouseover"
I have no idea how to solve the second question. You could ask at watir-general.
You can look at the following page for mouse controls:
http://wiki.openqa.org/display/WTR/Right+Click+an+Element

Resources