PDA

View Full Version : WebQrCode flickering



Anders Ohrt
1-Nov-2022, 08:45 AM
Hi,

I have a cWebQrCode on a page and noticed that whenever something changes on the page, the QR code redraws. I have a label counting down from 30 via timer, so it looks horrible.

In the resize function in WebQrCode.js, a redraw is made if the height or width changes. But it only saves the smallest of the height and width, so unless the clientWidth and clientHeight are identical, it will always think something changed and redraw.

I changed it as below, to fixed it.



resize : function(){
// Forward Send (before so base class can add wrapping elements)
WebQrCode.base.resize.call(this);

var smallest = Math.min(this._eControl.clientWidth, this._eControl.clientHeight);

// Redraw when neccessary
if (this._eQrCode._htOption.width != smallest ||
this._eQrCode._htOption.height != smallest){

// For redraw
this._eQrCode._htOption.height = smallest;
this._eQrCode._htOption.width = smallest;

// For direct resize
this._eQrCode._oDrawing._elCanvas.height = smallest;
this._eQrCode._oDrawing._elCanvas.width = smallest;

// Draw the QR code
this.makeCode(this.psValue);
}

},

Vincent Oorsprong
2-Nov-2022, 05:37 AM
Anders,

Is this about the PassPhrase (https://www.dataaccess.eu/resources/downloads/download-category/download-subcategory-842?dagapsg=71) example?

Anders Ohrt
2-Nov-2022, 05:43 AM
Vincent,

No, I've just included the DFSecurity library (1.1) and added a cWebQrCode control to our application.

Raphael Theiler
26-Jan-2023, 02:28 AM
Do you have multiple elements in the view with "pbFillHeight" = true? We sometimes have "race conditions" where multiple elements try to resize each other constantly.

Anders Ohrt
26-Jan-2023, 02:47 AM
Hi Raphael,


Do you have multiple elements in the view with "pbFillHeight" = true? We sometimes have "race conditions" where multiple elements try to resize each other constantly.

No, there is only one such element (a tab container).