Coder Social home page Coder Social logo

Comments (14)

iquirino avatar iquirino commented on September 15, 2024

i >= (count - drawImageSize.hideXDots) / 2 &&

You inverted the algorithm.
It must be:

      if (this._options.imageOptions.hideBackgroundDots) {
        if (
          j >= (count - drawImageSize.hideXDots) / 2 &&
          j < (count + drawImageSize.hideXDots) / 2 &&
          i >= (count - drawImageSize.hideYDots) / 2 &&
          i < (count + drawImageSize.hideYDots) / 2
        ) {
          return false;
        }
      }

from styled-qr-code.

iquirino avatar iquirino commented on September 15, 2024

#3

from styled-qr-code.

iquirino avatar iquirino commented on September 15, 2024

It is working now:
image

;)

I'm glad to contribute with your project

from styled-qr-code.

Loskir avatar Loskir commented on September 15, 2024

Hello!

Yes indeed it seems that i here corresponds to y axis and j corresponds to x (albeit usually it is the opposite way)

const x = yBeginning + j * dotSize;
const y = xBeginning + i * dotSize;

I don't have a deep understanding of this code so I'm not entirely sure what is the best way to fix it. Could you please open an issue or a PR in the upstream repo?

I'd be happy to merge the fix after that and release a new version. Thank you for your contribution!

from styled-qr-code.

iquirino avatar iquirino commented on September 15, 2024

The issue is on the filter itself, that skips dots to be printed on the QRCode.

if (filter && !filter(i, j)) {
  continue;
}

Here's my PR: https://github.com/Loskir/styled-qr-code/pull/3/files

from styled-qr-code.

Loskir avatar Loskir commented on September 15, 2024

Well I'm not sure it is the right change to do either as it creates a discrepancy between filter(i, j) and (j: number, i: number): boolean

from styled-qr-code.

AleAmla987 avatar AleAmla987 commented on September 15, 2024

@Loskir Hello! Were you able to fix that problem with the QR turning over?

from styled-qr-code.

iquirino avatar iquirino commented on September 15, 2024

I am running my fork in production and everything is working well

from styled-qr-code.

AleAmla987 avatar AleAmla987 commented on September 15, 2024

I am running my fork in production and everything is working well

You know that I have that problem in production, that the QR is turned around and does not center the logo space properly. How did you solve that in production? Locally I tried the change you recommend but in production that change is lost.

from styled-qr-code.

AleAmla987 avatar AleAmla987 commented on September 15, 2024

Estoy ejecutando mi bifurcación en producción y todo funciona bien.

How can I install your modifications?

from styled-qr-code.

iquirino avatar iquirino commented on September 15, 2024

I'm sorry, it worked well, but I am running the Loskir version, because I am using square images at this time.

from styled-qr-code.

AleAmla987 avatar AleAmla987 commented on September 15, 2024

I'm sorry, it worked well, but I am running the Loskir version, because I am using square images at this time.

I don't understand, it still appears vertical to me when I use a horizontal logo. Would you be kind to tell me what I should do to make it look good? In the local version, modify the code as you had indicated and it worked, but the production version did not.

from styled-qr-code.

CmCarti avatar CmCarti commented on September 15, 2024

Just came across this issue myself, the patch @iquirino created does seem to fix the issue. Any chance this will be published in the production package sometime soon?

from styled-qr-code.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.