/*

--- _onClickMinMax( MouseEvent ) ---

onclick event handler for the MinMax button

This event maximize / minimize the pins control
427709
function ( MouseEvent ) { 
		var PinsElement = document.getElementById ( 'PinControl-Pins' );
		var ReduceButtonElement = 	document.getElementById ( _ReduceButtonId );
		var ExtendButtonElement = 	document.getElementById ( _ExtendButtonId );
		if ( PinsElement.style.visibility === "hidden" ) {
			PinsElement.setAttribute ( "style", "visibility : visible; width: auto; min-width: 20em; height: auto; margin: 0.5em; max-height: "+ _MaxHeight +"px" );
			MouseEvent.target.id = _MinimizeButtonId;
			MouseEvent.target.setAttribute ( 'title' , _Translator.getText ( 'L.Marker.Pin.Control.onAdd.MinimizeButton' ) );
			PinsElement.dataset.minimized = 'no';
			ReduceButtonElement.setAttribute ( "style", "visibility : visible; width: 34px; height: 34px; padding: 1px; margin: 3px;" );
			ExtendButtonElement.setAttribute ( "style", "visibility : visible; width: 34px; height: 34px; padding: 1px; margin: 3px;" );
		}
		else {
			PinsElement.setAttribute ( "style", "visibility : hidden; width: 0; min-width: 0; height: 0; margin: 0.5em;" );
			MouseEvent.target.id = _MaximizeButtonId;
			MouseEvent.target.setAttribute ( 'title' , _Translator.getText ( 'L.Marker.Pin.Control.onAdd.MaximizeButton' ) );
			PinsElement.dataset.minimized = 'yes';
			ReduceButtonElement.setAttribute ( "style", "visibility : hidden; width: 0; height: 0; padding: 0; margin : 0" );
			ExtendButtonElement.setAttribute ( "style", "visibility : hidden; width: 0; height: 0; padding: 0; margin : 0" );
		}
		MouseEvent.stopPropagation ( );
	}
428236
public void setMinMax(double min, double max)
    {
        if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min))
            throw new IllegalArgumentException("min value must be positive, not " + min);
        else if(min >= max || Double.isNaN(max) || Double.isInfinite(max))
            throw new IllegalArgumentException("max (" + max + ") must be larger than min (" + min+")" );
        this.max = max;
        this.min = min;
        this.logMax = Math.log(max);
        this.logMin = Math.log(min);
        this.logDiff = logMax-logMin;
        this.diff = max-min;
    }
514717
@UiHandler("m_cancelButton")
    void cancelAction(ClickEvent event) {

        m_clipboard.reloadFavorites();
        m_buttonEditingPanel.setVisible(false);
        m_buttonUsePanel.setVisible(true);
    }
130704
@UiHandler("m_fadePanel")
    void onFadeClick(ClickEvent event) {

        m_textbox.setFocus(true);
        m_textbox.setCursorPos(m_textbox.getText().length());
    }
855396
public void setMax(int max)
    {
        this.max = max;
        if (this.max < Alterable.MIN)
        {
            this.max = Alterable.MIN;
        }
        set(cur);
    }
872348
function(e) {
        var min = this.minSlider,
            max = this.maxSlider,
            minLocked = min.isLocked() || !min.backgroundEnabled,
            maxLocked = max.isLocked() || !min.backgroundEnabled,
            Ev  = YAHOO.util.Event,
            d;

        if (minLocked || maxLocked) {
            this.activeSlider = minLocked ? max : min;
        } else {
            if (this.isHoriz) {
                d = Ev.getPageX(e)-min.thumb.initPageX-min.thumbCenterPoint.x;
            } else {
                d = Ev.getPageY(e)-min.thumb.initPageY-min.thumbCenterPoint.y;
            }
                    
            this.activeSlider = d*2 > max.getValue()+min.getValue() ? max : min;
        }
    }
885485
function(mouseEvent /* optional */) {
			var actionTaken = false;
			if (!this.isVisible()) {
				this.dispatchEvent({type: "triggered", dropdown: this, event: mouseEvent}); //$NON-NLS-0$
				if (this._populate) {
					this.empty();
					this._populate(this._dropdownNode);
				}
				var items = this.getItems();
				if (items.length > 0) {
					lib.setFramesEnabled(false);
					if (this._boundAutoDismiss) {
						lib.removeAutoDismiss(this._boundAutoDismiss);
					} 
					this._boundAutoDismiss = this._autoDismiss.bind(this);

					this._triggerNode.classList.add("dropdownTriggerOpen"); //$NON-NLS-0$
					this._triggerNode.setAttribute("aria-expanded", "true"); //$NON-NLS-1$ //$NON-NLS-0$
					if (this._selectionClass) {
						this._triggerNode.classList.add(this._selectionClass);
					}
					this._dropdownNode.classList.add("dropdownMenuOpen"); //$NON-NLS-0$
					this._isVisible = true;
					
					if (this._dropdownNode.scrollHeight > this._dropdownNode.offsetHeight) {
						this._buttonsAdded = addScrollButtons.call(this);
					}

					// add auto dismiss.  Clicking anywhere but trigger or a submenu item means close.
					var submenuNodes = lib.$$array(".dropdownSubMenu", this._dropdownNode); //$NON-NLS-0$
					var list = [this._triggerNode].concat(submenuNodes);
					if (this._buttonsAdded) {
						list.push(this._topScrollButton);
						list.push(this._bottomScrollButton);
					}
					lib.addAutoDismiss(list, this._boundAutoDismiss);
					this._positionDropdown(mouseEvent);
					
					if (this._buttonsAdded) {
						positionScrollButtons.call(this);
					}					
					
					this._focusDropdownNode();
					actionTaken = true;
					
					if (this._parentDropdown) {
						this._parentDropdown.submenuOpen(this);
					}
					
					if (this._trapTabs) {
						lib.trapTabs(this._dropdownNode);
					}
				}
			}
			return actionTaken;
		}
816836
def mouseDoubleClickEvent(self, event):
        
        item = self.itemAt(event.pos())
        column = self.columnAt(event.pos().x())
        
        mid_button = event.button() == QtCore.Qt.MidButton
        ctrl_click = event.button() == QtCore.Qt.LeftButton and \
                     event.modifiers() == QtCore.Qt.ControlModifier
        
        if mid_button or ctrl_click:
            self.itemMiddleDoubleClicked.emit(item, column)
        elif event.button() == QtCore.Qt.RightButton:
            self.itemRightDoubleClicked.emit(item, column)
        else:
            super(XTreeWidget, self).mouseDoubleClickEvent(event)
1217979
function () {
            if (!this._cfg.maximized) { // in maximized mode, positioning is handled by the Popup itself
                var position = this._popupContainer.calculatePosition(this._domElt);
                this.setProperty("xpos", position.left);
                this.setProperty("ypos", position.top);
            }
        }
1188960
function getMinMax() {
  var minPt = pts[0];
  var maxPt = pts[0];
  for (var i=1; i<pts.length; i++) {
    minPt = minPt.$min( pts[i] );
  }
  for (i=1; i<pts.length; i++) {
    maxPt = maxPt.$max( pts[i] );
  }
  nextRect.set( minPt).to( maxPt );
}
564487
public static void checkMinMax(int min, int max) {
    checkMin(min);
    checkMax(max);
    checkArgument(min <= max, "min > max");
  }
679581
private void slideKnob(Event event) {

        if (m_slidingMouse) {
            m_lastMouseY = event.getClientY();
            int shift = (int)((m_lastMouseY - m_mouseSlidingStartY) / m_positionValueRatio);
            int nextValue = m_mouseSlidingStartValue + shift;
            CmsDebugLog.getInstance().printLine("Mouse sliding should set value to: " + nextValue);
            int max = getMaximumVerticalScrollPosition();
            int min = getMinimumVerticalScrollPosition();
            if (nextValue < min) {
                nextValue = min;
            } else if (nextValue > max) {
                nextValue = max;
            }
            setValue(Integer.valueOf(nextValue));
        }
    }
836108
public void onClick(MenuItemClickEvent event) {
		if (feature != null && feature.isSelected()) {
			FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().startEditing(
					new Feature[] { feature.clone() }, new Feature[] { feature.clone() });
			mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.ALL);
			VectorLayer vLayer = feature.getLayer();
			if (vLayer.getLayerInfo().getLayerType() == LayerType.POINT) {
				controller.setController(new PointEditController(mapWidget, controller));
			} else if (vLayer.getLayerInfo().getLayerType() == LayerType.MULTIPOINT) {
				mapWidget.getMapModel().getFeatureEditor().stopEditing();
				mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.DELETE);
				SC.warn("Editing of MultiPoint layers is not supported yet....");
			} else if (vLayer.getLayerInfo().getLayerType() == LayerType.LINESTRING) {
				controller.setController(new LineStringEditController(mapWidget, controller));
			} else if (vLayer.getLayerInfo().getLayerType() == LayerType.MULTILINESTRING) {
				controller.setController(new MultiLineStringEditController(mapWidget, controller));
			} else if (vLayer.getLayerInfo().getLayerType() == LayerType.POLYGON) {
				controller.setController(new PolygonEditController(mapWidget, controller));
			} else if (vLayer.getLayerInfo().getLayerType() == LayerType.MULTIPOLYGON) {
				controller.setController(new MultiPolygonEditController(mapWidget, controller));
			}
			controller.setEditMode(EditMode.DRAG_MODE);
		}
	}
1069708
function(min, max) {
    return function limitZoom(params) {
      params.zoom = clamp(params.zoom, min, max);
      return params;
    };
  }
162852
function (newMin, newMax) {

		// Prevent pinch zooming out of range. Check for defined is for #1946.
		if (!this.allowZoomOutside) {
			if (defined(this.dataMin) && newMin <= this.dataMin) {
				newMin = UNDEFINED;
			}
			if (defined(this.dataMax) && newMax >= this.dataMax) {
				newMax = UNDEFINED;
			}
		}

		// In full view, displaying the reset zoom button is not required
		this.displayBtn = newMin !== UNDEFINED || newMax !== UNDEFINED;
		
		// Do it
		this.setExtremes(
			newMin,
			newMax,
			false, 
			UNDEFINED, 
			{ trigger: 'zoom' }
		);
		return true;
	}
144859
function onTriggerClick(e, noFocus) {
    toggleSubmenu(elements.trigger, (_, done) => {
      Classlist(elements.trigger).toggle(ACTIVE_CLASS);
      const wasActive = Classlist(elements.menu).contains(ACTIVE_CLASS);
      const first = wasActive ? ACTIVE_CLASS : 'dqpl-show';
      const second = first === ACTIVE_CLASS ? 'dqpl-show' : ACTIVE_CLASS;

      Classlist(elements.menu).toggle(first);

      if (elements.scrim) {
        Classlist(elements.scrim).toggle('dqpl-scrim-show');
      }

      setTimeout(() => {
        Classlist(elements.menu).toggle(second);
        if (elements.scrim) { Classlist(elements.scrim).toggle('dqpl-scrim-fade-in'); }
        setTimeout(() => done(noFocus));
      }, 100);
    });
  }
402621
function ( DragEvent ) { 
		if ( _Pins.readOnly ) {
			DragEvent.stopPropagation ( );
			return;
		}
		
		var SelectedElement = DragEvent.target;
		while ( SelectedElement && SelectedElement.className && ( -1 === SelectedElement.className.indexOf ('PinControl-Pin' ) ) ) {
			SelectedElement = SelectedElement.parentNode;
		}
		var DroppedPinRange;
		if ( SelectedElement && SelectedElement.className && ( -1 !== SelectedElement.className.indexOf ('PinControl-Pin' ) ) ) {
			DroppedPinRange =  SelectedElement.dataset.pinRange;
			if (  ( DragEvent.clientY - SelectedElement.getBoundingClientRect().top ) < ( SelectedElement.getBoundingClientRect().bottom - DragEvent.clientY ) ) {
				_Pins.order ( _DraggedPinRange, DroppedPinRange, false );
			}
			else {
				_Pins.order ( _DraggedPinRange, DroppedPinRange, true );
			}
		}
		DragEvent.stopPropagation ( );
	}