Commits

Anonymous committed b5c7a09

prevent dragging when click is on scrollbar.

Comments (0)

Files changed (4)

static/css/src/colors.css

     color: #fff;
     background-color: #e5f1f4;
 }
-
+.comment-box #reviews-list {
+    background: #fff;
+}
 #reviews-list li {
     color: #303030;
-    border-bottom-color: #899834;
+    border-bottom-color: #dcdcdc;
 }
 
 #reviews-list li time {

static/css/src/layout.css

     margin-left: 10px;
 }
 
+.comment-box #reviews-list {
+    margin: 0.3em;
+    background: #fff;
+}
 
 #reviews-list li {
     display: block;
     width: 99%;
     margin: 5px 0 10px 0;
-    padding: 0.3em;
     border-bottom: 1px dashed;
  
 }

static/js/src/review.js

             tag_name=='OPTION' ||
             tag_name=='BUTTON' ||
             tag_name=='TEXTAREA')) return;
-        
+       
+        base2.DOM.bind(e.target);
+        var point = pointer(e);
+        this.boxDimensions = this.divComment.getDimensions();
+
+        // detect if we have clicked on scrollbar
+        if (e.target.getStyle("overflow") != "hidden") {
+            var scrollbarWidth = getScrollbarWidth();
+            var offsets = this.divComment.getOffsets();
+            var clipX = offsets.x + this.boxDimensions.width - scrollbarWidth;
+            if (point.x > clipX)
+                return;
+        }
+
         this.isDragging = true;
 
         this.divComment.style.cursor = "move";
-        var point = pointer(e);
+        
         var pos = this.divComment.cumulativeOffset();
-       
+
         this.offset = [point.x - pos.x, point.y - pos.y];
         this.pointer = point;
-        this.boxDimensions = this.divComment.getDimensions();
+        
 
         // remove text selection
         document.body.focus();

static/js/src/utilities.js

  *
 */
 
+
+
+/**
+ * APIFunction: getScrollbarWidth
+ * This function has been modified by the OpenLayers from the original version,
+ *     written by Matthew Eernisse and released under the Apache 2 
+ *     license here:
+ * 
+ *     http://www.fleegix.org/articles/2006/05/30/getting-the-scrollbar-width-in-pixels
+ * 
+ *     It has been modified simply to cache its value, since it is physically 
+ *     impossible that this code could ever run in more than one browser at 
+ *     once. 
+ * 
+ * Returns:
+ * {Integer}
+ */
+
+_scrollbarWidth = null;
+getScrollbarWidth = function() {
+    
+    var scrollbarWidth = _scrollbarWidth;
+    
+    if (scrollbarWidth == null) {
+        var scr = null;
+        var inn = null;
+        var wNoScroll = 0;
+        var wScroll = 0;
+    
+        // Outer scrolling div
+        scr = document.createElement('div');
+        scr.style.position = 'absolute';
+        scr.style.top = '-1000px';
+        scr.style.left = '-1000px';
+        scr.style.width = '100px';
+        scr.style.height = '50px';
+        // Start with no scrollbar
+        scr.style.overflow = 'hidden';
+    
+        // Inner content div
+        inn = document.createElement('div');
+        inn.style.width = '100%';
+        inn.style.height = '200px';
+    
+        // Put the inner div in the scrolling div
+        scr.appendChild(inn);
+        // Append the scrolling div to the doc
+        document.body.appendChild(scr);
+    
+        // Width of the inner div sans scrollbar
+        wNoScroll = inn.offsetWidth;
+    
+        // Add the scrollbar
+        scr.style.overflow = 'scroll';
+        // Width of the inner div width scrollbar
+        wScroll = inn.offsetWidth;
+    
+        // Remove the scrolling div from the doc
+        document.body.removeChild(document.body.lastChild);
+    
+        // Pixel width of the scroller
+        _scrollbarWidth = (wNoScroll - wScroll);
+        scrollbarWidth = _scrollbarWidth;
+    }
+
+    return scrollbarWidth;
+};
+
 function _isBody(el) {
     return (el.tagName == "body" || el.tagName == "html")
 }