Make app size more or less(to normal) - mobile


#1

I made a app in html5 target. The app is no_scale mode (w/h = 0) .

WHat i can do for change size like magnifier two fingers resize? For example open google.com I can change size, and return to normal of two fingers tap, how i can do that for my app? (maybe settings again ?)
Thanks


#2

You could use the DOM target, and allow the browser to do that, or look at our default HTML file output, which I think cancels touch scrolling, but you could remove this in your own “index.html” template to allow it


#3

Thx for u answer. But I dont understand what u mean.
I use second way and remove :
>

    		window.addEventListener ("touchmove", function (event) { event.preventDefault (); }, false);
    		if (typeof window.devicePixelRatio != 'undefined' && window.devicePixelRatio > 2) {
    			var meta = document.getElementById ("viewport");
    			meta.setAttribute ('content', 'width=device-width, initial-scale=' + (2 / window.devicePixelRatio) + ', user-scalable=no');
    		}
    	</script>

after that - and after load the page, app looks bigger (elements size) than before, but touch magnifier did not allow too… (((

Project setting . And that its very intresting

  1. without allow-high-dpi the app set stage size is 1/2 of device size
  2. with allow-high-dpi the app set real stage size
  3. with allow-high-dpi and remove script - stage has DIFFRENT size than 1 or 2. WHat is that?

#4

You could try removing the "touchmove" listener, but leave the code that is setting the viewport

EDIT: Oh, it might also be necessary to make sure that double-click events go through. Double tapping somewhere other than the OpenFL content will probably still zoom, but it’s possible that we’re handling the double click and canceling the default event

EDIT 2: However, looking at our code, I only see us canceling mouse events to prevent a context menu: https://github.com/openfl/openfl/blob/092c8e3abf8a03d5954af469e184844cc3a33e34/src/openfl/display/Stage.hx#L636


#5

I mean : tap one finger, and hold it, tap other finger and move = makes zoom + or - , not double click. Standart feature to zoom photos in mobile (browser, apps, standart pictureViewer) for example. My openFL content 100%100% of window, so I dont have any elements for zoom, i want to zooming OpenFL content!


#6

Perhaps user-scalable=yes would make a difference?


#7

Yes Im trying it, nothing happens ((( maybe u can test it? Thanks a lot


#8

No ideas ??? anybody ??? (((
Maybe somebody knows how open App on LANDSCAPE mode only? After loaded page - set landscape and lock it for change orient ?


#9

Experimenting here, it looks like resizing the window works fine, until touching an area where OpenFL is embedded, where it is consuming the mouse events:

http://www.openfl.org/learn/npm/tutorials/adding-animation/

I’ve opened an issue here :slight_smile:

In the meantime, you should have a lot of flexibility using CSS to control how your application sizes


#10

U say, I can wrap openFL content in CSS classes and control sizes ?


#11

Yep, absolutely. Resize the DIV that the content is embedded in, and it should resize OpenFL accordingly, just be careful about dynamic sizes because we might run into a resize loop


#12

And what do u think about FIXED landscape? How it must be setted? I want to open app in landscape only after loaded, no portrait, also I want to be loaded in LANDSCAPE at once, not portrait and after one second change to landscape for example.


#13

Mobile native applications can require a specific orientation, but browser applications can only display something like “Please rotate your screen” with an icon to try and encourage the user to do so


#14

no way for browser, i understand(((