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

Set position of fixed stencil #282

Open
M-Barari opened this issue Jun 27, 2024 · 0 comments
Open

Set position of fixed stencil #282

M-Barari opened this issue Jun 27, 2024 · 0 comments

Comments

@M-Barari
Copy link

Hi, I'm using fixed stencil type

<cropper
  ref="cropper"
  :src="imgSrc"
  :stencil-props="{
      aspectRatio: 1,
      handlers: {},
      movable: false,
      resizable: false,
  }"
  imageRestriction="stencil"
  :resizeImage="{
      touch: true,
      wheel: {
          ratio: 0.1
      },
      adjustStencil: false
  }"
  :stencil-size="stencilSize"
  :default-boundaries="defaultBoundaries"
  @change="change"
  />
stencilSize({boundaries}) {
    return {
        width: boundaries?.width - 48,
        height: boundaries?.width - 48,
    }
},
defaultBoundaries({cropper, imageSize}){
    const el = document?.getElementById('modalBody')
    const maxHeight = window?.getComputedStyle(el)?.maxHeight
    const strecher = document.querySelector('.vue-advanced-cropper__stretcher')
    const height = Math.min(cropper.clientWidth+this.actionBoxHeight, parseInt(maxHeight, 10))
    if(strecher) strecher.style.height = height + 'px'
    return {
        width: cropper.clientWidth,
        height: height,
    }
},

I want the Stencil be at the top of canvas/boundaries with a 24px space from top and sides.
but it is always at center. is there a way to achieve that?? I'm also gonna use defaultPosition to set a coordinate on opened image. but the stencil must still be fixed at top and the image must move to that coordinate. is it possible at all???

@M-Barari M-Barari changed the title Set position of fixed stencil 🏷️question Set position of fixed stencil Jun 27, 2024
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