Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge showcoords and updatepreview #292

Open
richdenis86 opened this issue Jul 13, 2019 · 0 comments
Open

Merge showcoords and updatepreview #292

richdenis86 opened this issue Jul 13, 2019 · 0 comments

Comments

@richdenis86
Copy link

richdenis86 commented Jul 13, 2019

Hello! can anyone help me!
how to merge two parameters

`

    // Grab some information about the preview pane
    $preview = $('#preview-pane'),
    $pcnt = $('#preview-pane .preview-container'),
    $pimg = $('#preview-pane .preview-container img'),

    xsize = $pcnt.width(), 
    ysize = $pcnt.height();

console.log('init',[xsize,ysize]);
$('#target').Jcrop({
  onChange: updatePreview ,showCoords ,  
  onSelect: updatePreview , showCoords,
  aspectRatio: xsize / ysize,
  onRelease:  clearCoords
},function(){
  // Use the API to get the real image size
  var bounds = this.getBounds();
  boundx = bounds[0];
  boundy = bounds[1];
  // Store the API in the jcrop_api variable
  jcrop_api = this;

  // Move the preview into the jcrop container for css positioning
  $preview.appendTo(jcrop_api.ui.holder);
});

function updatePreview(c)
{
  if (parseInt(c.w) > 0)
  {
    var rx = xsize / c.w;
    var ry = ysize / c.h;

    $pimg.css({
      width: Math.round(rx * boundx) + 'px',
      height: Math.round(ry * boundy) + 'px',
      marginLeft: '-' + Math.round(rx * c.x) + 'px',
      marginTop: '-' + Math.round(ry * c.y) + 'px'
    });
  }
};
$('#coords').on('change','input',function(e){
  var x1 = $('#x1').val(),
      x2 = $('#x2').val(),
      y1 = $('#y1').val(),
      y2 = $('#y2').val();
  jcrop_api.setSelect([x1,y1,x2,y2]);
});`

somethink like this doesn't work
onChange: updatePreview ,showccords,
onSelect: updatePreview ,showcoords,

How to pass 2 parameters? updatePreview and showcoords

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant