Commit dd9ba7f4 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Diminution icone dossier + possibilité de trouver un angle de rotation...

Diminution icone dossier + possibilité de trouver un angle de rotation automatique pour redresser un scan de texte.
parent 37f75acc
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
{
  "name": "@certic/vue-jama",
  "version": "0.4.3",
  "version": "0.4.4",
  "scripts": {
    "serve": "rimraf -rf ./node_modules/.cache/vue-loader && vue-cli-service serve",
    "build": "vue-cli-service build",
+12 −9
Original line number Diff line number Diff line
@@ -106,17 +106,20 @@ export default {
  justify-content: center;
  position: relative !important;

  .collection-avatar {
    position: absolute;
    width: 100%;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  //.collection-avatar {
  //  position: absolute;
  //  width: 100%;
  //  height: 80%;
  //  display: flex;
  //  justify-content: center;
  //  align-items: center;
  //}

  .mdi-folder {
    font-size: 128px;
    font-size: 32px;
    position: relative;
    left : 0px;
    top:0px;
  }

  .v-icon {
+35 −25
Original line number Diff line number Diff line
@@ -142,11 +142,13 @@
              v-model="color"
              type="color"
              class="mb-2"
              :disabled="loading"
            >
            <v-btn
              small
              class="mb-5"
              title="reset"
              :disabled="loading"
              @click="reset"
            >
              <v-icon>mdi-reload</v-icon>
@@ -161,6 +163,7 @@
              step="1"
              type="number"
              min="0"
              :disabled="loading"
            />
            <v-text-field
              v-model="cropTop"
@@ -172,6 +175,7 @@
              step="1"
              type="number"
              min="0"
              :disabled="loading"
            />
            <v-text-field
              v-model="cropRight"
@@ -183,6 +187,7 @@
              step="1"
              type="number"
              min="0"
              :disabled="loading"
            />
            <v-text-field
              v-model="cropBottom"
@@ -194,6 +199,7 @@
              step="1"
              type="number"
              min="0"
              :disabled="loading"
            />
            <v-text-field
              v-model="rotation"
@@ -207,18 +213,29 @@
              min="-360"
              max="360"
              :disabled="loading"
              @input="rotateChanged($event)"
            />
            <v-btn
              class="mt-1"
              small
              :disabled="loading"
              :title="$t('auto_find')"
              @click="autoFindAngle()"
            >
              <v-icon>mdi-rotate-right</v-icon>
            </v-btn>

            <div class="mt-5 pa-0">
              <span class="mt-8 pt-5 grey--text">Zoom</span>
              <v-btn
                small
                :disabled="loading"
                @click="zoomIn(0.1)"
              >
                <v-icon>mdi-magnify-plus</v-icon>
              </v-btn>
              <v-btn
                small
                :disabled="loading"
                class="caption mt-1"
                @click="resetZoom()"
              >
@@ -226,6 +243,7 @@
              </v-btn>
              <v-btn
                small
                :disabled="loading"
                class="mt-1"
                @click="zoomIn(-0.1)"
              >
@@ -330,13 +348,6 @@ export default {
          + 'margin:' + this.margin + 'px!important';
    },

    // getPreviewImageCSS() {
    //   return 'width:' + this.renderedImageDimensions.width + 'px;'
    //       + 'height:' + this.renderedImageDimensions.height + 'px;'
    //       + 'background-image:url("' + this.imageUrl + '");'
    //       + 'margin:'+this.margin+'px!important';
    // },

    translateX() {
      return this.cropLeft * this.scale
    },
@@ -419,7 +430,13 @@ export default {
          (res) => {
            if (res) {
              this.loading = true;
              this.$jamaClient.pictureRotateCrop(this.resource.id, this.normalizedRotation, this.cropTop, this.cropRight, this.cropBottom, this.cropLeft).then((res) => {
              this.$jamaClient.pictureRotateCrop(
                  this.resource.id,
                  this.normalizedRotation,
                  this.cropTop,
                  this.cropRight,
                  this.cropBottom,
                  this.cropLeft).then((res) => {
                if (res)
                  this.$jamaAlert('Image modifiée avec succès.');
                else
@@ -437,21 +454,13 @@ export default {

    },

    updateRenderedDimensions() {
      // this.loading = true;
      // if(this.renderTimeout)
      //   clearInterval(this.renderInterval);
      // this.renderInterval = setInterval(() => {
      //   let image = new Image();
      //   image.src = this.scaledAndRotatedImageUrl
      //   image.onload = () => {
      //     this.loading = false;
      //     this.renderedImageDimensions = {
      //       width: image.naturalWidth,
      //       height: image.naturalHeight
      //     };
      //   };
      // }, 500);
    autoFindAngle(){
      this.loading = true;
      this.$jamaClient.autoFindRotateAngle(this.resource.id).then((angle)=>{
        console.log("AUTO FOUND ANGLE = ", angle)
        this.rotation = Number(angle);
        this.loading = false;
      })
    },

    dragStart(evt, dir) {
@@ -750,11 +759,12 @@ input[type=color] {
<i18n>
{
  "en": {
    "auto_find": "Auto compute a rotation angle",
    "confirm": "confirm ?"
  },
  "fr": {
    "auto_find": "Calcul automatique de l'angle de rotation",
    "confirm": "Confirmer la modification de la ressource ?"

  }
}
</i18n>
 No newline at end of file
+11 −0
Original line number Diff line number Diff line
@@ -819,6 +819,16 @@ class JamaClient {
        return this._rpc("ancestors_from_resource", [resource_id]);
    }

    /**
     * Tries to determine skew angle of image with text.
     *
     * @param {BigInteger} resource_id
     * @returns {Number}
     */
    async autoFindRotateAngle(resource_id) {
        return this._rpc("auto_find_rotate_angle", [resource_id]);
    }


    /**
     * Change the value of a meta for a collection.
@@ -1932,6 +1942,7 @@ class JamaClient {
        return this._rpc("public_collections", [project_id]);
    }


}

export {JamaClient, upload_events}