I can't make the Drawing Canvas fully RESPONSIVE

Not favoritedFavorited Favorited 0 favourites
  • 2 posts
From the Asset Store
you can add, remove and reorder list items and many more
  • drive.google.com/file/d/10_IYhqDGUiVVlr2embIOh0UK1cAd5BR9/view

    I can't make the canvas responsive at very horizontal scales; it goes crazy.

    When it's not in full screen, the phone doesn't display completely, etc.

    I've tried everything, this is beyond my knowledge and the AI

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I already managed to do it, it is by taking the size of the layer with Parallax s 100%

    / === 2. GET INSTANCES (Estilo Imagen) === const layoutActual = runtime.layout; const capaHUD = layoutActual.getLayer(nombreCapaHUD); const lienzo = runtime.objects[nombreTipoCanvas]?.getFirstInstance(); // Usa el nombre correcto const gv = runtime.globalVars; // Acceso a globales, usado en la parte de dibujo // === 3. CALCULATE HUD/CANVAS TARGET GEOMETRY (Estilo Imagen) === // (Calcula hudVisibleWidth, hudVisibleHeight, hudTopLeftX, hudTopLeftY usando cssPxToLayer) let hudVisibleWidth = 0, hudVisibleHeight = 0, hudTopLeftX = 0, hudTopLeftY = 0; let hudIsValid = false; if (capaHUD && capaHUD.parallaxX === 1 && capaHUD.parallaxY === 1) { const anchoInternoVentana = window.innerWidth; const altoInternoVentana = window.innerHeight; if (anchoInternoVentana > 0 && altoInternoVentana > 0) { try { [hudTopLeftX, hudTopLeftY] = capaHUD.cssPxToLayer(0, 0); const [hudBottomRightX, hudBottomRightY] = capaHUD.cssPxToLayer(anchoInternoVentana, altoInternoVentana); hudVisibleWidth = hudBottomRightX - hudTopLeftX; hudVisibleHeight = hudBottomRightY - hudTopLeftY; if (hudVisibleWidth > 0 && hudVisibleHeight > 0) { hudIsValid = true; } } catch (e) { console.error("[SETUP] Error coord conversion:", e); hudIsValid = false; } } } // === 4. POSITION AND RESIZE CANVAS (Estilo Imagen) === // (Ajusta lienzo.x, lienzo.y, lienzo.width, lienzo.height basado en los cálculos anteriores) let canvasReadyForDrawing = false; if (hudIsValid && lienzo && lienzo.layer === capaHUD) { const targetX = hudTopLeftX + margenX; const targetY = hudTopLeftY + margenY; const targetWidth = hudVisibleWidth; const targetHeight = hudVisibleHeight; if (lienzo.x !== targetX || lienzo.y !== targetY) { lienzo.x = targetX; lienzo.y = targetY; lienzo.positionChanged = true; } if (lienzo.width !== targetWidth || lienzo.height !== targetHeight) { lienzo.width = targetWidth; lienzo.height = targetHeight; lienzo.sizeChanged = true; } if (lienzo.width > 0 && lienzo.height > 0) { canvasReadyForDrawing = true; } }

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)