]> _ Git - fluidbook-html5.git/commitdiff
wait #4854 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 9 Nov 2021 18:07:32 +0000 (19:07 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 9 Nov 2021 18:07:32 +0000 (19:07 +0100)
images/symbols/cart-overlay.svg
js/libs/fluidbook/fluidbook.cart.js
js/libs/fluidbook/fluidbook.links.js
style/cart.less

index 1ceaf7fb691331bc594d3d684ba5fbd273777556..2096d4bde0d44fe0b4a9ad7f580f10d04e65b7c3 100644 (file)
@@ -1,19 +1,19 @@
 <svg xmlns="http://www.w3.org/2000/svg" style="display:none;">
-    <symbol id="link-cart-add-hover" viewBox="0 0 34 34">
+    <symbol id="link-cart-add-hover" viewBox="0 0 35 35">
         <path d="M17.5,0.5c-9.4,0-17,7.6-17,17c0,9.4,7.6,17,17,17c9.4,0,17-7.6,17-17C34.5,8.1,26.9,0.5,17.5,0.5z M26.2,18.5
                h-7.8v7.8h-2v-7.8H8.8v-2h7.8V8.8h2v7.8h7.8V18.5z"/>
     </symbol>
-    <symbol id="link-cart-remove-hover" viewBox="0 0 34 34">
+    <symbol id="link-cart-remove-hover" viewBox="0 0 35 35">
         <path d="M17.5,0.5c-9.4,0-17,7.6-17,17c0,9.4,7.6,17,17,17s17-7.6,17-17C34.5,8.1,26.9,0.5,17.5,0.5z M26.2,18.5H8.8
                v-2h17.5V18.5z"/>
     </symbol>
-    <symbol id="link-cart-add" viewBox="0 0 34 34">
+    <symbol id="link-cart-add" viewBox="0 0 35 35">
         <path d="M17.5,0C7.9,0,0,7.9,0,17.5S7.9,35,17.5,35S35,27.1,35,17.5S27.1,0,17.5,0z M17.5,34C8.4,34,1,26.6,1,17.5
                S8.4,1,17.5,1S34,8.4,34,17.5S26.6,34,17.5,34z"/>
         <polygon points="18.5,8.8 16.5,8.8 16.5,16.5 8.8,16.5 8.8,18.5 16.5,18.5 16.5,26.2 18.5,26.2 18.5,18.5 26.3,18.5
                26.3,16.5 18.5,16.5     "/>
     </symbol>
-    <symbol id="link-cart-remove" viewBox="0 0 34 34">
+    <symbol id="link-cart-remove" viewBox="0 0 35 35">
         <path d="M17.5,0C7.9,0,0,7.9,0,17.5S7.9,35,17.5,35S35,27.1,35,17.5S27.1,0,17.5,0z M17.5,34C8.4,34,1,26.6,1,17.5
                S8.4,1,17.5,1S34,8.4,34,17.5S26.6,34,17.5,34z"/>
         <rect x="8.7" y="16.5" width="17.5" height="2"/>
index 6718837037cdb135316d31fd65ecd0340c752c23..6ca7ef480e9afa0b995fbba6af541b58f09e2be9 100644 (file)
@@ -63,16 +63,29 @@ FluidbookCart.prototype = {
     },
 
     updateLinks: function () {
+        console.log('updatelinks');
+
         $('a[data-cart-ref]').removeClass('active');
+
         try {
             var references = this.instance.getItemsReferences();
+            $.each(references, function (k, ref) {
+                $('a[data-cart-ref="' + ref + '"]').addClass('active');
+            });
         } catch (err) {
-            return;
         }
 
-        $.each(references, function (k, ref) {
-            $('a[data-cart-ref="' + ref + '"]').addClass('active');
-        });
+        if (this.fluidbook.settings.cartLinkAppearance === 'overlay') {
+            $('a[data-cart-ref]').each(function () {
+
+                var paddingTop = 0.5 * ($(this).outerHeight() - 100);
+                var paddingLeft = 0.5 * ($(this).outerWidth() - 300);
+                $(this).attr('data-tooltip', null).addClass('overlay').css({
+                    paddingTop: paddingTop,
+                    paddingLeft: paddingLeft
+                }).html('<div class="remove">' + getSpriteIcon('link-cart-remove') + getSpriteIcon('link-cart-remove-hover') + '</div><div class="add">' + getSpriteIcon('link-cart-add') + getSpriteIcon('link-cart-add-hover') + '</div>');
+            });
+        }
     },
     getMenuWidth: function () {
         try {
index 4b11ac28a80cd0581876d34c55cddc2e927d4482..d0b5c3141f97c479976915cf5d52031073de0bb3 100644 (file)
@@ -457,7 +457,7 @@ FluidbookLinks.prototype = {
         }, 200);
 
 
-        $(fluidbook).trigger('fluidbook.links.ready');
+        $(this.fluidbook).trigger('fluidbook.links.ready');
         this.resize();
     },
 
index 4dd39b508178477f8d602754a9e0e2c8c9c6c2a0..79946a4b27544052f0f8d0a1182b17894d1a0988 100644 (file)
@@ -1 +1,54 @@
-@import "cart/@{import-cart-styles}";
\ No newline at end of file
+@import "cart/@{import-cart-styles}";
+
+a[data-cart-ref] {
+  &.overlay {
+    color: #fff;
+
+    div {
+      @w: 100px;
+      display: none;
+      position: relative;
+      width: @w;
+      height: @w;
+
+      &:last-child {
+        margin-left: @w;
+      }
+
+      svg {
+        top:0;
+        left: 0;
+        width: @w;
+        height: @w;
+        overflow: visible;
+        position: absolute;
+        display: block;
+
+        &:first-child {
+          display: none;
+        }
+      }
+
+      &:hover {
+        svg {
+          &:first-child {
+            display: block;
+          }
+
+          &:last-child {
+            display: none;
+          }
+        }
+      }
+    }
+
+    &.displayArea:hover {
+      background-color: rgba(0, 0, 0, 0.65);
+      mix-blend-mode: multiply;
+
+      div {
+        display: inline-block;
+      }
+    }
+  }
+}
\ No newline at end of file