iOS Safari Fullscreen Problem.
scroll up safari brower
hide address bar
cocos creator canvas change screen ratio (scale up (up and down)) not normal
i want refresh change screen environment apply (design ratio)
Addition)
I Want Div’s touch Event → send Cocos Creator
code not working.
function ProcTouch(evt){
let cv = document.getElementById(“GameCanvas”);
cv.style.width = window.innerWidth+‘px’;
cv.style.height = window.innerHeight+‘px’;
cv.dispatchEvent(evt);
}
window.addEventListener(“touchstart”, ProcTouch);
window.addEventListener(“touchmove”, ProcTouch);
window.addEventListener(“touchend”, ProcTouch);
Plz Share your knowledge
1 Like
Hi, the problem is because the engine side handles the touch event registered by window.addEventListener and stops the event from bubbling upwards, thus making it invalid.
Way 1: is to customize the engine (by modifying the code in that part and compiling the engine).
way 2: after building, by modifying the engine source code after building.
let registerTouchEvent = function (eventName) {
let handler = _touchEventsMap[eventName];
element.addEventListener(eventName, (function(event) {
if (!event.changedTouches) return;
let body = document.body;
canvasBoundingRect.adjustedLeft = canvasBoundingRect.left - (body.scrollLeft || window.scrollX || 0);
canvasBoundingRect.adjustedTop = canvasBoundingRect.top - (body.scrollTop || window.scrollY || 0);
handler(selfPointer.getTouchesByEvent(event, canvasBoundingRect));
event.stopPropagation();
event.preventDefault();
}), false);
thank you
But I decided to do it another way
Someday I’ll use the way you talked
I think my problem is different now
I found api
cc.view.setFrameSize(window.innerWidth,window.innerHeight);
cc.view.setCanvasSize(window.innerWidth,window.innerHeight);
canvas size change - ok
touch position - different
i want change size cocos creator html tag canvas
Same as changing in browser
i try call funtions
cc.view.setCanvasSize(window.innerWidth,window.innerHeight);
cc.view._resize();
cc.internal.inputManager._updateCanvasBoundingRect();
cc._widgetManager.onResized();
but different touch position…
cocos creator 2.4.8 version
Can you provide me with a demo?
environment
ios phone (me iphone14 pro), landscape
ios safari full screen problem
test url
http://grapegaming.synology.me:22780/full/
change landscape mode
drag up (scroll up) → Hide Address Bar
portrait button - ok
landscape button - not working
I commented on the post.
Please confirm.
Hi, through your test link, I can reproduce your problem, this problem, can you provide a test project?
upload project and build result
index file in build result == (drag up) see
I tried many option. but failed
I have to satisfy a need to be able to easily switch to fullscreen on ios.
This site works fine.
BGaming - online casino games and slots provider! BGaming provides the variety of captivating online casino slots and table games having the world’s fiat currencies, cryptocurrencies, with clear interface and HD mobile-friendly.
Just play the demo.
If you rotate it horizontally, it will ask you to drag it up, and if you drag it, it will be full screen.
I want to do like that site too.
How is your research going?