Help fixing a plugin [Solved]

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Ok, I'm using this plugin:

    construct.net/en/make-games/addons/190/html-element

    Here's the problem. When the browser is resized, the plugin resizes as well. I need this size to remain static. I've left an issue report with the creator but no response yet. I've attempted to fix this myself but the problem is, I'm a PHP programmer, not a JS programmer and I'm not sure what I'm looking at.

    I think I've narrowed the problem down to one function in the plugin code but can't come up with a solution. Here's the code:

    DrawSize() {
    
    
     if (!this.domStructure.useC3size) return;
    
    
     // conservo la dimensione precedente
     // se è uguale non devo fare nulla
     const exWidth = Dom.width(this.el);
     const exHeight = Dom.height(this.el);
    
     // mi prendo i riferimenti per calcolare le dimensioni
     const wi = this._inst.GetWorldInfo();
     const layer = wi.GetLayer();
     const quad = wi.GetBoundingQuad();
     // prendo l'angolo in alto a sinistra e poi le coordinate in alto a dx e in basso a sx
     const tlx = quad.getTlx();
     const tly = quad.getTly();
     const trx = quad.getTrx();
     const bly = quad.getBly();
    
     // calcolo le nuove dimensioni
    
     const myinstance = this._inst.GetWorldInfo();
     const instWidth = myinstance.GetWidth();
     const instHeight = myinstance.GetHeight();
     const newWidth = Math.abs(layer.LayerToDrawSurface(instWidth,0)[0]);
     const newHeight = Math.abs(layer.LayerToDrawSurface(0, instHeight)[1]);
    
     // se le nuove dimensioni sono diverse da quelle precedenti
     // allora aggiorno la dimensione dell'elemento
     if (exWidth !== newWidth || exHeight !== newHeight || this.memory.resizeWindowForSize) {
     this.memory.resizeWindowForSize = false;
     this.SetStyle({
     'width': newWidth + 'px',
     'height': newHeight + 'px'
     });
     }
     },
    

    If I drop this plugin on a form and do a simple browser.onResized and set the size of the HTML Element box to random(100,500), random(100,500) the height will randomize. The width does not. It adjusts based only on the browser size.

    Any help would be appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nevermind, my stupidity. Six hours of tearing a plugin apart and I find a line in the c3 code I didn't remember adding that adjusted it's width again. Duh.

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