Giter Site home page Giter Site logo

Comments (4)

lathonez avatar lathonez commented on July 29, 2024 1

Hey,

I guess it's to do with the all the sizing you're doing?

        this.signaturePad.set('canvasWidth', (this.content.contentWidth / 2) - 5);
        this.signaturePad.set('canvasHeight', (this.content.contentHeight / 2) * 0.84);
//
        this.signaturePad.resizeCanvas()
        this.content.resize();

Check out the demo app, which has a responsive pad: https://github.com/lathonez/angular2-signaturepad-demo/blob/master/src/app/app.component.ts#L30-L44

Let us know if that doesn't solve it, or if you're looking to achieve something outside of what the demo app is doing.

Stephen

from angular2-signaturepad.

lathonez avatar lathonez commented on July 29, 2024 1

Unsure what the problem is supposed to be.

If something is not working on init, but is working after resize, and you have bound it to window.resize explicitly, there is possibly an issue with the initialisation code?

Google Ionic Nav Lifecycle events and apply your initialisation code to the appropriate event, as opposed to ngAfterViewInit.

from angular2-signaturepad.

nowitz avatar nowitz commented on July 29, 2024

Hey,
thank you for your advice, mouse position is coordinates. :-) But now I have a problem with height on first open page, how can you see on images.
snimek obrazovky 2017-04-03 v 21 14 48
snimek obrazovky 2017-04-03 v 21 16 46

I have this html, sass and code:

<ion-content class="backColor" (window:resize)="beResponsive()">
  <div class="sig-container" #sigContainer1>
    <div fxLayout="row">
      <signature-field></signature-field>
    </div>
  </div>

  <div class="sig-button" fxLayout="row">
    <button ion-button full color="danger" (click)="clearPad()">{{'SIGNATURE.CANCEL' | translate}}</button>
    <button ion-button full color="secondary" (click)="savePad()">{{'SIGNATURE.SAVE' | translate}}</button>
  </div>
</ion-content>
.sig-container {
    height: 80%;
    canvas {
      background: white;
    }
  }
  .sig-button{
    display: flex;
    height: 20%;
    button{
      margin: auto 4px;
    }
  }
 @ViewChildren(SignatureFieldComponent) public sigs: QueryList<SignatureFieldComponent>;
 @ViewChildren('sigContainer1') public sigContainer1: QueryList<ElementRef>;

 public ngAfterViewInit() {
        this.beResponsive();
    }
   
 public beResponsive() {
        this.size(this.sigContainer1.first, this.sigs.first);
    }
 
 public size(container: ElementRef, sig: SignatureFieldComponent){
        sig.signaturePad.set('canvasWidth', container.nativeElement.clientWidth);
        sig.signaturePad.set('canvasHeight', container.nativeElement.clientHeight);
    }

Thank you for your help
John

from angular2-signaturepad.

nowitz avatar nowitz commented on July 29, 2024

You have right, this is right event: ionViewDidEnter.
Thank you for your advice.

from angular2-signaturepad.

Related Issues (20)

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.