获取拖动时允许的X轴坐标
@param dragTd
@param evt
334507
function getPermissionX(dragTd, evt) {
        var ut = getUETable(dragTd);
        if (ut) {
            var preTd = ut.getSameEndPosCells(dragTd, "x")[0],
                nextTd = ut.getSameStartPosXCells(dragTd)[0],
                mouseX = mouseCoords(evt).x,
                left = (preTd ? domUtils.getXY(preTd).x : domUtils.getXY(ut.table).x) + 20 ,
                right = nextTd ? domUtils.getXY(nextTd).x + nextTd.offsetWidth - 20 : (me.body.offsetWidth + 5 || parseInt(domUtils.getComputedStyle(me.body, "width"), 10));

            left += cellMinWidth;
            right -= cellMinWidth;

            return mouseX < left ? left : mouseX > right ? right : mouseX;
        }
    }
780636
function(evt) {
		if (canvas.spaceKey || evt.button === 1) {return;}

		var right_click = evt.button === 2;
	
		if (evt.altKey) { // duplicate when dragging
			svgCanvas.cloneSelectedElements(0, 0);
		}
	
		root_sctm = $('#svgcontent g')[0].getScreenCTM().inverse();
		
		var pt = svgedit.math.transformPoint( evt.pageX, evt.pageY, root_sctm ),
			mouse_x = pt.x * current_zoom,
			mouse_y = pt.y * current_zoom;
			
		evt.preventDefault();

		if (right_click) {
			current_mode = "select";
			lastClickPoint = pt;
		}
		
		// This would seem to be unnecessary...
//		if (['select', 'resize'].indexOf(current_mode) == -1) {
//			setGradient();
//		}
		
		var x = mouse_x / current_zoom,
			y = mouse_y / current_zoom,
			mouse_target = getMouseTarget(evt);
		
		if (mouse_target.tagName === 'a' && mouse_target.childNodes.length === 1) {
			mouse_target = mouse_target.firstChild;
		}
		
		// real_x/y ignores grid-snap value
		var real_x = x;
		r_start_x = start_x = x;
		var real_y = y;
		r_start_y = start_y = y;

		if (curConfig.gridSnapping){
			x = svgedit.utilities.snapToGrid(x);
			y = svgedit.utilities.snapToGrid(y);
			start_x = svgedit.utilities.snapToGrid(start_x);
			start_y = svgedit.utilities.snapToGrid(start_y);
		}

		// if it is a selector grip, then it must be a single element selected, 
		// set the mouse_target to that and update the mode to rotate/resize
		
		if (mouse_target == selectorManager.selectorParentGroup && selectedElements[0] != null) {
			var grip = evt.target;
			var griptype = elData(grip, "type");
			// rotating
			if (griptype == "rotate") {
				current_mode = "rotate";
			}
			// resizing
			else if (griptype == "resize") {
				current_mode = "resize";
				current_resize_mode = elData(grip, "dir");
			}
			mouse_target = selectedElements[0];
		}
		
		startTransform = mouse_target.getAttribute("transform");
		var i, stroke_w,
			tlist = svgedit.transformlist.getTransformList(mouse_target);
		switch (current_mode) {
			case "select":
				started = true;
				current_resize_mode = "none";
				if (right_click) {started = false;}
				
				if (mouse_target != svgroot) {
					// if this element is not yet selected, clear selection and select it
					if (selectedElements.indexOf(mouse_target) == -1) {
						// only clear selection if shift is not pressed (otherwise, add 
						// element to selection)
						if (!evt.shiftKey) {
							// No need to do the call here as it will be done on addToSelection
							clearSelection(true);
						}
						addToSelection([mouse_target]);
						justSelected = mouse_target;
						pathActions.clear();
					}
					// else if it's a path, go into pathedit mode in mouseup
					
					if (!right_click) {
						// insert a dummy transform so if the element(s) are moved it will have
						// a transform to use for its translate
						for (i = 0; i < selectedElements.length; ++i) {
							if (selectedElements[i] == null) {continue;}
							var slist = svgedit.transformlist.getTransformList(selectedElements[i]);
							if (slist.numberOfItems) {
								slist.insertItemBefore(svgroot.createSVGTransform(), 0);
							} else {
								slist.appendItem(svgroot.createSVGTransform());
							}
						}
					}
				} else if (!right_click){
					clearSelection();
					current_mode = "multiselect";
					if (rubberBox == null) {
						rubberBox = selectorManager.getRubberBandBox();
					}
					r_start_x *= current_zoom;
					r_start_y *= current_zoom;
//					console.log('p',[evt.pageX, evt.pageY]);					
//					console.log('c',[evt.clientX, evt.clientY]);	
//					console.log('o',[evt.offsetX, evt.offsetY]);	
//					console.log('s',[start_x, start_y]);
					
					svgedit.utilities.assignAttributes(rubberBox, {
						'x': r_start_x,
						'y': r_start_y,
						'width': 0,
						'height': 0,
						'display': 'inline'
					}, 100);
				}
				break;
			case "zoom": 
				started = true;
				if (rubberBox == null) {
					rubberBox = selectorManager.getRubberBandBox();
				}
				svgedit.utilities.assignAttributes(rubberBox, {
						'x': real_x * current_zoom,
						'y': real_x * current_zoom,
						'width': 0,
						'height': 0,
						'display': 'inline'
				}, 100);
				break;
			case "resize":
				started = true;
				start_x = x;
				start_y = y;
				
				// Getting the BBox from the selection box, since we know we
				// want to orient around it
				init_bbox = svgedit.utilities.getBBox($('#selectedBox0')[0]);
				var bb = {};
				$.each(init_bbox, function(key, val) {
					bb[key] = val/current_zoom;
				});
				init_bbox = bb;
				
				// append three dummy transforms to the tlist so that
				// we can translate,scale,translate in mousemove
				var pos = svgedit.utilities.getRotationAngle(mouse_target) ? 1 : 0;
				
				if (svgedit.math.hasMatrixTransform(tlist)) {
					tlist.insertItemBefore(svgroot.createSVGTransform(), pos);
					tlist.insertItemBefore(svgroot.createSVGTransform(), pos);
					tlist.insertItemBefore(svgroot.createSVGTransform(), pos);
				} else {
					tlist.appendItem(svgroot.createSVGTransform());
					tlist.appendItem(svgroot.createSVGTransform());
					tlist.appendItem(svgroot.createSVGTransform());
					
					if (svgedit.browser.supportsNonScalingStroke()) {
						// Handle crash for newer Chrome and Safari 6 (Mobile and Desktop): 
						// https://code.google.com/p/svg-edit/issues/detail?id=904
						// Chromium issue: https://code.google.com/p/chromium/issues/detail?id=114625
						// TODO: Remove this workaround once vendor fixes the issue
						var isWebkit = svgedit.browser.isWebkit();

						if (isWebkit) {
							var delayedStroke = function(ele) {
								var _stroke = ele.getAttributeNS(null, 'stroke');
								ele.removeAttributeNS(null, 'stroke');
								//Re-apply stroke after delay. Anything higher than 1 seems to cause flicker
								setTimeout(function() { ele.setAttributeNS(null, 'stroke', _stroke); }, 0);
							};
						}
						mouse_target.style.vectorEffect = 'non-scaling-stroke';
						if (isWebkit) {delayedStroke(mouse_target);}

						var all = mouse_target.getElementsByTagName('*'),
							len = all.length;
						for (i = 0; i < len; i++) {
							all[i].style.vectorEffect = 'non-scaling-stroke';
							if (isWebkit) {delayedStroke(all[i]);}
						}
					}
				}
				break;
			case "fhellipse":
			case "fhrect":
			case "fhpath":
				start.x = real_x;
				start.y = real_y;
				started = true;
				d_attr = real_x + "," + real_y + " ";
				stroke_w = cur_shape.stroke_width == 0 ? 1 : cur_shape.stroke_width;
				addSvgElementFromJson({
					"element": "polyline",
					"curStyles": true,
					"attr": {
						"points": d_attr,
						"id": getNextId(),
						"fill": "none",
						"opacity": cur_shape.opacity / 2,
						"stroke-linecap": "round",
						"style": "pointer-events:none"
					}
				});
				freehand.minx = real_x;
				freehand.maxx = real_x;
				freehand.miny = real_y;
				freehand.maxy = real_y;
				break;
			case "image":
				started = true;
				var newImage = addSvgElementFromJson({
					"element": "image",
					"attr": {
						"x": x,
						"y": y,
						"width": 0,
						"height": 0,
						"id": getNextId(),
						"opacity": cur_shape.opacity / 2,
						"style": "pointer-events:inherit"
					}
				});
				setHref(newImage, last_good_img_url);
				preventClickDefault(newImage);
				break;
			case "square":
				// FIXME: once we create the rect, we lose information that this was a square
				// (for resizing purposes this could be important)
			case "rect":
				started = true;
				start_x = x;
				start_y = y;
				addSvgElementFromJson({
					"element": "rect",
					"curStyles": true,
					"attr": {
						"x": x,
						"y": y,
						"width": 0,
						"height": 0,
						"id": getNextId(),
						"opacity": cur_shape.opacity / 2
					}
				});
				break;
			case "line":
				started = true;
				stroke_w = cur_shape.stroke_width == 0 ? 1 : cur_shape.stroke_width;
				addSvgElementFromJson({
					"element": "line",
					"curStyles": true,
					"attr": {
						"x1": x,
						"y1": y,
						"x2": x,
						"y2": y,
						"id": getNextId(),
						"stroke": cur_shape.stroke,
						"stroke-width": stroke_w,
						"stroke-dasharray": cur_shape.stroke_dasharray,
						"stroke-linejoin": cur_shape.stroke_linejoin,
						"stroke-linecap": cur_shape.stroke_linecap,
						"stroke-opacity": cur_shape.stroke_opacity,
						"fill": "none",
						"opacity": cur_shape.opacity / 2,
						"style": "pointer-events:none"
					}
				});
				break;
			case "circle":
				started = true;
				addSvgElementFromJson({
					"element": "circle",
					"curStyles": true,
					"attr": {
						"cx": x,
						"cy": y,
						"r": 0,
						"id": getNextId(),
						"opacity": cur_shape.opacity / 2
					}
				});
				break;
			case "ellipse":
				started = true;
				addSvgElementFromJson({
					"element": "ellipse",
					"curStyles": true,
					"attr": {
						"cx": x,
						"cy": y,
						"rx": 0,
						"ry": 0,
						"id": getNextId(),
						"opacity": cur_shape.opacity / 2
					}
				});
				break;
			case "text":
				started = true;
				var newText = addSvgElementFromJson({
					"element": "text",
					"curStyles": true,
					"attr": {
						"x": x,
						"y": y,
						"id": getNextId(),
						"fill": cur_text.fill,
						"stroke-width": cur_text.stroke_width,
						"font-size": cur_text.font_size,
						"font-family": cur_text.font_family,
						"text-anchor": "middle",
						"xml:space": "preserve",
						"opacity": cur_shape.opacity
					}
				});
//					newText.textContent = "text";
				break;
			case "path":
				// Fall through
			case "pathedit":
				start_x *= current_zoom;
				start_y *= current_zoom;
				pathActions.mouseDown(evt, mouse_target, start_x, start_y);
				started = true;
				break;
			case "textedit":
				start_x *= current_zoom;
				start_y *= current_zoom;
				textActions.mouseDown(evt, mouse_target, start_x, start_y);
				started = true;
				break;
			case "rotate":
				started = true;
				// we are starting an undoable change (a drag-rotation)
				canvas.undoMgr.beginUndoableChange("transform", selectedElements);
				break;
			default:
				// This could occur in an extension
				break;
		}
		
		var ext_result = runExtensions("mouseDown", {
			event: evt,
			start_x: start_x,
			start_y: start_y,
			selectedElements: selectedElements
		}, true);
		
		$.each(ext_result, function(i, r) {
			if (r && r.started) {
				started = true;
			}
		});
	}
968551
function (evt) {
            this._move(evt.src);
            this._initialDrag = null;
            this._initialSavedX = null;
            if (this._oldValue[0] !== this.value[0] || this._oldValue[1] !== this.value[1]) {
                if (this._cfg.onchange) {
                    this._context.evalCallback(this._cfg.onchange);
                }
            }
        }
579086
function (evt) {

            var movable = this.getMovable();
            if (movable && movable.style) {
                var mouseInitPos = this._mouseInitialPosition;
                var movableInitPos = this._movableInitialGeometry;

                var offsetX = this._vertical ? 0 : evt.clientX - mouseInitPos.left;
                var offsetY = this._horizontal ? 0 : evt.clientY - mouseInitPos.top;
                var geometry = ariaUtilsJson.copy(movableInitPos), dw, dh;

                geometry = this._resizeWitHandlers(geometry, this.cursor, offsetX, offsetY);

                var chkWidth = /sw-resize|nw-resize|w-resize/.test(this.cursor), chkHeight = /nw-resize|ne-resize|n-resize/.test(this.cursor), minWidth = geometry.width < this.minWidth, minHeight = geometry.height < this.minHeight;

                if (minWidth) {
                    geometry.width = this.minWidth;
                }
                if (minHeight) {
                    geometry.height = this.minHeight;
                }

                dw = this._movableGeometry.x + this._movableGeometry.width;
                dh = this._movableGeometry.y + this._movableGeometry.height;
                if (minWidth && chkWidth) {
                    geometry.x = dw - this.minWidth;
                }
                if (minHeight && chkHeight) {
                    geometry.y = dh - this.minHeight;
                }
                // for resizing the dialog
                movable.style.cursor = this.cursor;
                movable.style.top = (geometry.y - this._baseMovableOffset.top) + "px";
                movable.style.left = (geometry.x - this._baseMovableOffset.left) + "px";
                movable.style.height = (geometry.height - this._baseMovableOffset.height) + "px";
                movable.style.width = (geometry.width - this._baseMovableOffset.width) + "px";

                this.posY = mouseInitPos.top + geometry.y - movableInitPos.y;
                this.posX = mouseInitPos.left + geometry.x - movableInitPos.x;
                this._movableGeometry = geometry;
                this.$raiseEvent("resize");
            }
        }
110518
def dragEnterEvent( self, event ):
        
        filt = self.dragDropFilter()
        if ( not filt ):
            super(XCalendarWidget, self).dragEnterEvent(event)
            return
        
        filt(self, event)
369634
function draggableDayEvent(event, eventElement, seg) {
		var isStart = seg.isStart;
		var origWidth;
		var revert;
		var allDay = true;
		var dayDelta;
		var hoverListener = getHoverListener();
		var colWidth = getColWidth();
		var snapHeight = getSnapHeight();
		var snapMinutes = getSnapMinutes();
		var minMinute = getMinMinute();
		eventElement.draggable({
			opacity: opt('dragOpacity', 'month'), // use whatever the month view was using
			revertDuration: opt('dragRevertDuration'),
			start: function(ev, ui) {
				trigger('eventDragStart', eventElement, event, ev, ui);
				hideEvents(event, eventElement);
				origWidth = eventElement.width();
				hoverListener.start(function(cell, origCell) {
					clearOverlays();
					if (cell) {
						revert = false;
						var origDate = cellToDate(0, origCell.col);
						var date = cellToDate(0, cell.col);
						dayDelta = dayDiff(date, origDate);
						if (!cell.row) {
							// on full-days
							renderDayOverlay(
								addDays(cloneDate(event.start), dayDelta),
								addDays(exclEndDay(event), dayDelta)
							);
							resetElement();
						}else{
							// mouse is over bottom slots
							if (isStart) {
								if (allDay) {
									// convert event to temporary slot-event
									eventElement.width(colWidth - 10); // don't use entire width
									setOuterHeight(
										eventElement,
										snapHeight * Math.round(
											(event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) /
												snapMinutes
										)
									);
									eventElement.draggable('option', 'grid', [colWidth, 1]);
									allDay = false;
								}
							}else{
								revert = true;
							}
						}
						revert = revert || (allDay && !dayDelta);
					}else{
						resetElement();
						revert = true;
					}
					eventElement.draggable('option', 'revert', revert);
				}, ev, 'drag');
			},
			stop: function(ev, ui) {
				hoverListener.stop();
				clearOverlays();
				trigger('eventDragStop', eventElement, event, ev, ui);
				if (revert) {
					// hasn't moved or is out of bounds (draggable has already reverted)
					resetElement();
					eventElement.css('filter', ''); // clear IE opacity side-effects
					showEvents(event, eventElement);
				}else{
					// changed!
					var minuteDelta = 0;
					if (!allDay) {
						minuteDelta = Math.round((eventElement.offset().top - getSlotContainer().offset().top) / snapHeight)
							* snapMinutes
							+ minMinute
							- (event.start.getHours() * 60 + event.start.getMinutes());
					}
					eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui);
				}
			}
		});
		function resetElement() {
			if (!allDay) {
				eventElement
					.width(origWidth)
					.height('')
					.draggable('option', 'grid', null);
				allDay = true;
			}
		}
	}
175194
function (evt) {
        this.lastMoveEvt = evt;
        if (this.started && !this.timeoutId && (evt.xy.x != this.last.x ||
                                                evt.xy.y != this.last.y)) {
            if(this.documentDrag === true && this.documentEvents) {
                if(evt.element === document) {
                    this.adjustXY(evt);
                    // do setEvent manually because the documentEvents are not
                    // registered with the map
                    this.setEvent(evt);
                } else {
                    this.removeDocumentEvents();
                }
            }
            if (this.interval > 0) {
                this.timeoutId = setTimeout(
                    OpenLayers.Function.bind(this.removeTimeout, this),
                    this.interval);
            }
            this.dragging = true;

            this.move(evt);
            this.callback("move", [evt.xy]);
            if(!this.oldOnselectstart) {
                this.oldOnselectstart = document.onselectstart;
                document.onselectstart = OpenLayers.Function.False;
            }
            this.last = evt.xy;
        }
        return true;
    }
1007234
function (evt) {
                var movable = this.getMovable();
                var domUtil = ariaUtilsDom;

                if (movable && movable.style) {
                    var geometry = ariaUtilsJson.copy(this._movableGeometry);
                    var mouseInitPos = this._mouseInitialPosition;
                    var movableInitPos = this._movableInitialGeometry;
                    if (!this._vertical) {
                        geometry.x = movableInitPos.x + evt.clientX - mouseInitPos.left;
                    }
                    if (!this._horizontal) {
                        geometry.y = movableInitPos.y + evt.clientY - mouseInitPos.top;
                    }
                    var pos = (this._boundary) ? domUtil.fitInside(geometry, this._boundary) : {
                        top : geometry.y,
                        left : geometry.x
                    };

                    movable.style.top = (pos.top - this._baseMovableOffset.top) + "px";
                    movable.style.left = (pos.left - this._baseMovableOffset.left) + "px";

                    geometry.y = pos.top;
                    geometry.x = pos.left;

                    this.posY = mouseInitPos.top + geometry.y - movableInitPos.y;
                    this.posX = mouseInitPos.left + geometry.x - movableInitPos.x;
                    this._movableGeometry = geometry;
                    this.$raiseEvent("move");
                }
            }
816761
function (oEvent) {
					if (!oRow.getEnableAppointmentsResize() || oTimeline._isOneMonthIntervalOnSmallSizes() || !oTimeline._isResizingPerformed()) {
						oEvent.preventDefault();
						return;
					}

					var oDragSession = oEvent.getParameter("dragSession"),
						$CalendarRowAppsOverlay = oTimeline.$().find(".sapUiCalendarRowAppsOverlay"),
						$Indicator = jQuery(oDragSession.getIndicator()),
						$DraggedControl = oDragSession.getDragControl().$();

					$Indicator.addClass("sapUiDnDIndicatorHide");
					setTimeout(function () {
						$CalendarRowAppsOverlay.addClass("sapUiCalendarRowAppsOverlayDragging");
					}, 0);

					jQuery(document).one("dragend", function () {
						$CalendarRowAppsOverlay.removeClass("sapUiCalendarRowAppsOverlayDragging");
						$Indicator.removeClass("sapUiDnDIndicatorHide");
						$DraggedControl.css({
							width: "auto",
							"min-width": "auto",
							"z-index": "auto",
							opacity: 1
						});
					});

					if (!Device.browser.msie && !Device.browser.edge) {
						oEvent.getParameter("browserEvent").dataTransfer.setDragImage(getResizeGhost(), 0, 0);
					}
				}
715769
def drag_events(self):
        
        if not self.is_dragging:
            return None

        event = self
        events = []
        while True:
            # mouse_press events can only be the start of a trail
            if event is None or event.type == 'mouse_press':
                break
            events.append(event)
            event = event.last_event

        return events[::-1]
335446
function(evt) {
    this._startPoint = evt.containerPoint.clone();
    this._dragStartPoint = evt.containerPoint.clone();
    this._matrix = [1, 0, 0, 1, 0, 0];

    this._path._map
      .on('mousemove', this._onDrag, this)
      .on('mouseup', this._onDragEnd, this)
    this._path._dragMoved = false;
  }
519881
function(evt) {
        if (!OpenLayers.Event.isLeftClick(evt) && !OpenLayers.Event.isSingleTouch(evt)) {
            return;
        }
        this.map.events.on({
            "touchmove": this.passEventToSlider,
            "mousemove": this.passEventToSlider,
            "mouseup": this.passEventToSlider,
            scope: this
        });
        this.mouseDragStart = evt.xy.clone();
        this.zoomStart = evt.xy.clone();
        this.div.style.cursor = "move";
        // reset the div offsets just in case the div moved
        this.zoombarDiv.offsets = null; 
        OpenLayers.Event.stop(evt);
    }
785218
function(evt) {
		if (!started) {return;}
		if (evt.button === 1 || canvas.spaceKey) {return;}

		var i, xya, c, cx, cy, dx, dy, len, angle, box,
			selected = selectedElements[0],
			pt = svgedit.math.transformPoint( evt.pageX, evt.pageY, root_sctm ),
			mouse_x = pt.x * current_zoom,
			mouse_y = pt.y * current_zoom,
			shape = svgedit.utilities.getElem(getId());

		var real_x = mouse_x / current_zoom;
		x = real_x;
		var real_y = mouse_y / current_zoom;
		y = real_y;
	
		if (curConfig.gridSnapping){
			x = svgedit.utilities.snapToGrid(x);
			y = svgedit.utilities.snapToGrid(y);
		}

		evt.preventDefault();
		var tlist;
		switch (current_mode) {
			case "select":
				// we temporarily use a translate on the element(s) being dragged
				// this transform is removed upon mousing up and the element is 
				// relocated to the new location
				if (selectedElements[0] !== null) {
					dx = x - start_x;
					dy = y - start_y;
					
					if (curConfig.gridSnapping){
						dx = svgedit.utilities.snapToGrid(dx);
						dy = svgedit.utilities.snapToGrid(dy);
					}

					if (evt.shiftKey) { 
						xya = svgedit.math.snapToAngle(start_x, start_y, x, y);
						x = xya.x;
						y = xya.y; 
					}

					if (dx != 0 || dy != 0) {
						len = selectedElements.length;
						for (i = 0; i < len; ++i) {
							selected = selectedElements[i];
							if (selected == null) {break;}
//							if (i==0) {
//								var box = svgedit.utilities.getBBox(selected);
//									selectedBBoxes[i].x = box.x + dx;
//									selectedBBoxes[i].y = box.y + dy;
//							}

							// update the dummy transform in our transform list
							// to be a translate
							var xform = svgroot.createSVGTransform();
							tlist = svgedit.transformlist.getTransformList(selected);
							// Note that if Webkit and there's no ID for this
							// element, the dummy transform may have gotten lost.
							// This results in unexpected behaviour
							
							xform.setTranslate(dx, dy);
							if (tlist.numberOfItems) {
								tlist.replaceItem(xform, 0);
							} else {
								tlist.appendItem(xform);
							}
							
							// update our internal bbox that we're tracking while dragging
							selectorManager.requestSelector(selected).resize();
						}
						
						call("transition", selectedElements);
					}
				}
				break;
			case "multiselect":
				real_x *= current_zoom;
				real_y *= current_zoom;
				svgedit.utilities.assignAttributes(rubberBox, {
					'x': Math.min(r_start_x, real_x),
					'y': Math.min(r_start_y, real_y),
					'width': Math.abs(real_x - r_start_x),
					'height': Math.abs(real_y - r_start_y)
				}, 100);

				// for each selected:
				// - if newList contains selected, do nothing
				// - if newList doesn't contain selected, remove it from selected
				// - for any newList that was not in selectedElements, add it to selected
				var elemsToRemove = [], elemsToAdd = [],
					newList = getIntersectionList();
				len = selectedElements.length;
				
				for (i = 0; i < len; ++i) {
					var ind = newList.indexOf(selectedElements[i]);
					if (ind == -1) {
						elemsToRemove.push(selectedElements[i]);
					} else {
						newList[ind] = null;
					}
				}
				
				len = newList.length;
				for (i = 0; i < len; ++i) {
					if (newList[i]) {elemsToAdd.push(newList[i]);}
				}
				
				if (elemsToRemove.length > 0) {
					canvas.removeFromSelection(elemsToRemove);
				}
				
				if (elemsToAdd.length > 0) {
					addToSelection(elemsToAdd);
				}
					
				break;
			case "resize":
				// we track the resize bounding box and translate/scale the selected element
				// while the mouse is down, when mouse goes up, we use this to recalculate
				// the shape's coordinates
				tlist = svgedit.transformlist.getTransformList(selected);
				var hasMatrix = svgedit.math.hasMatrixTransform(tlist);
				box = hasMatrix ? init_bbox : svgedit.utilities.getBBox(selected);
				var left = box.x, top = box.y, width = box.width,
					height = box.height;
					dx = (x-start_x);
					dy = (y-start_y);
				
				if (curConfig.gridSnapping) {
					dx = svgedit.utilities.snapToGrid(dx);
					dy = svgedit.utilities.snapToGrid(dy);
					height = svgedit.utilities.snapToGrid(height);
					width = svgedit.utilities.snapToGrid(width);
				}

				// if rotated, adjust the dx,dy values
				angle = svgedit.utilities.getRotationAngle(selected);
				if (angle) {
					var r = Math.sqrt( dx*dx + dy*dy ),
						theta = Math.atan2(dy, dx) - angle * Math.PI / 180.0;
					dx = r * Math.cos(theta);
					dy = r * Math.sin(theta);
				}

				// if not stretching in y direction, set dy to 0
				// if not stretching in x direction, set dx to 0
				if (current_resize_mode.indexOf("n")==-1 && current_resize_mode.indexOf("s")==-1) {
					dy = 0;
				}
				if (current_resize_mode.indexOf("e")==-1 && current_resize_mode.indexOf("w")==-1) {
					dx = 0;
				}				
				
				var ts = null,
					tx = 0, ty = 0,
					sy = height ? (height+dy)/height : 1, 
					sx = width ? (width+dx)/width : 1;
				// if we are dragging on the north side, then adjust the scale factor and ty
				if (current_resize_mode.indexOf("n") >= 0) {
					sy = height ? (height-dy)/height : 1;
					ty = height;
				}
				
				// if we dragging on the east side, then adjust the scale factor and tx
				if (current_resize_mode.indexOf("w") >= 0) {
					sx = width ? (width-dx)/width : 1;
					tx = width;
				}
				
				// update the transform list with translate,scale,translate
				var translateOrigin = svgroot.createSVGTransform(),
					scale = svgroot.createSVGTransform(),
					translateBack = svgroot.createSVGTransform();

				if (curConfig.gridSnapping) {
					left = svgedit.utilities.snapToGrid(left);
					tx = svgedit.utilities.snapToGrid(tx);
					top = svgedit.utilities.snapToGrid(top);
					ty = svgedit.utilities.snapToGrid(ty);
				}

				translateOrigin.setTranslate(-(left+tx), -(top+ty));
				if (evt.shiftKey) {
					if (sx == 1) {sx = sy;}
					else {sy = sx;}
				}
				scale.setScale(sx, sy);
				
				translateBack.setTranslate(left+tx, top+ty);
				if (hasMatrix) {
					var diff = angle ? 1 : 0;
					tlist.replaceItem(translateOrigin, 2+diff);
					tlist.replaceItem(scale, 1+diff);
					tlist.replaceItem(translateBack, Number(diff));
				} else {
					var N = tlist.numberOfItems;
					tlist.replaceItem(translateBack, N-3);
					tlist.replaceItem(scale, N-2);
					tlist.replaceItem(translateOrigin, N-1);
				}

				selectorManager.requestSelector(selected).resize();
				
				call("transition", selectedElements);
				
				break;
			case "zoom":
				real_x *= current_zoom;
				real_y *= current_zoom;
				svgedit.utilities.assignAttributes(rubberBox, {
					'x': Math.min(r_start_x*current_zoom, real_x),
					'y': Math.min(r_start_y*current_zoom, real_y),
					'width': Math.abs(real_x - r_start_x*current_zoom),
					'height': Math.abs(real_y - r_start_y*current_zoom)
				}, 100);			
				break;
			case "text":
				svgedit.utilities.assignAttributes(shape,{
					'x': x,
					'y': y
				}, 1000);
				break;
			case "line":
				// Opera has a problem with suspendRedraw() apparently
				var handle = null;
				if (!window.opera) {svgroot.suspendRedraw(1000);}

				if (curConfig.gridSnapping) {
					x = svgedit.utilities.snapToGrid(x);
					y = svgedit.utilities.snapToGrid(y);
				}

				var x2 = x;
				var y2 = y;					

				if (evt.shiftKey) {
					xya = svgedit.math.snapToAngle(start_x, start_y, x2, y2);
					x2 = xya.x;
					y2 = xya.y;
				}
				
				shape.setAttributeNS(null, "x2", x2);
				shape.setAttributeNS(null, "y2", y2);
				if (!window.opera) {svgroot.unsuspendRedraw(handle);}
				break;
			case "foreignObject":
				// fall through
			case "square":
				// fall through
			case "rect":
				// fall through
			case "image":
				var square = (current_mode == 'square') || evt.shiftKey,
					w = Math.abs(x - start_x),
					h = Math.abs(y - start_y),
					new_x, new_y;
				if (square) {
					w = h = Math.max(w, h);
					new_x = start_x < x ? start_x : start_x - w;
					new_y = start_y < y ? start_y : start_y - h;
				} else {
					new_x = Math.min(start_x, x);
					new_y = Math.min(start_y, y);
				}
	
				if (curConfig.gridSnapping) {
					w = svgedit.utilities.snapToGrid(w);
					h = svgedit.utilities.snapToGrid(h);
					new_x = svgedit.utilities.snapToGrid(new_x);
					new_y = svgedit.utilities.snapToGrid(new_y);
				}

				svgedit.utilities.assignAttributes(shape,{
					'width': w,
					'height': h,
					'x': new_x,
					'y': new_y
				},1000);
				
				break;
			case "circle":
				c = $(shape).attr(["cx", "cy"]);
				cx = c.cx;
				cy = c.cy;
				var rad = Math.sqrt( (x-cx)*(x-cx) + (y-cy)*(y-cy) );
				if (curConfig.gridSnapping) {
					rad = svgedit.utilities.snapToGrid(rad);
				}
				shape.setAttributeNS(null, "r", rad);
				break;
			case "ellipse":
				c = $(shape).attr(["cx", "cy"]);
				cx = c.cx;
				cy = c.cy;
				// Opera has a problem with suspendRedraw() apparently
					handle = null;
				if (!window.opera) {svgroot.suspendRedraw(1000);}
				if (curConfig.gridSnapping) {
					x = svgedit.utilities.snapToGrid(x);
					cx = svgedit.utilities.snapToGrid(cx);
					y = svgedit.utilities.snapToGrid(y);
					cy = svgedit.utilities.snapToGrid(cy);
				}
				shape.setAttributeNS(null, "rx", Math.abs(x - cx) );
				var ry = Math.abs(evt.shiftKey?(x - cx):(y - cy));
				shape.setAttributeNS(null, "ry", ry );
				if (!window.opera) {svgroot.unsuspendRedraw(handle);}
				break;
			case "fhellipse":
			case "fhrect":
				freehand.minx = Math.min(real_x, freehand.minx);
				freehand.maxx = Math.max(real_x, freehand.maxx);
				freehand.miny = Math.min(real_y, freehand.miny);
				freehand.maxy = Math.max(real_y, freehand.maxy);
			// break; missing on purpose
			case "fhpath":
//				d_attr += + real_x + "," + real_y + " ";
//				shape.setAttributeNS(null, "points", d_attr);
				end.x = real_x; end.y = real_y;
				if (controllPoint2.x && controllPoint2.y) {
					for (i = 0; i < STEP_COUNT - 1; i++) {
						parameter = i / STEP_COUNT;
						nextParameter = (i + 1) / STEP_COUNT;
						bSpline = getBsplinePoint(nextParameter);
						nextPos = bSpline;
						bSpline = getBsplinePoint(parameter);
						sumDistance += Math.sqrt((nextPos.x - bSpline.x) * (nextPos.x - bSpline.x) + (nextPos.y - bSpline.y) * (nextPos.y - bSpline.y));
						if (sumDistance > THRESHOLD_DIST) {
							d_attr += + bSpline.x + "," + bSpline.y + " ";
							shape.setAttributeNS(null, "points", d_attr);
							sumDistance -= THRESHOLD_DIST;
						}
					}
				}
				controllPoint2 = {x:controllPoint1.x, y:controllPoint1.y};
				controllPoint1 = {x:start.x, y:start.y};
				start = {x:end.x, y:end.y};
				break;
			// update path stretch line coordinates
			case "path":
				// fall through
			case "pathedit":
				x *= current_zoom;
				y *= current_zoom;
				
				if (curConfig.gridSnapping) {
					x = svgedit.utilities.snapToGrid(x);
					y = svgedit.utilities.snapToGrid(y);
					start_x = svgedit.utilities.snapToGrid(start_x);
					start_y = svgedit.utilities.snapToGrid(start_y);
				}
				if (evt.shiftKey) {
					var path = svgedit.path.path;
					var x1, y1;
					if (path) {
						x1 = path.dragging?path.dragging[0]:start_x;
						y1 = path.dragging?path.dragging[1]:start_y;
					} else {
						x1 = start_x;
						y1 = start_y;
					}
					xya = svgedit.math.snapToAngle(x1, y1, x, y);
					x = xya.x;
					y = xya.y;
				}
				
				if (rubberBox && rubberBox.getAttribute('display') !== 'none') {
					real_x *= current_zoom;
					real_y *= current_zoom;
					svgedit.utilities.assignAttributes(rubberBox, {
						'x': Math.min(r_start_x*current_zoom, real_x),
						'y': Math.min(r_start_y*current_zoom, real_y),
						'width': Math.abs(real_x - r_start_x*current_zoom),
						'height': Math.abs(real_y - r_start_y*current_zoom)
					},100);	
				}
				pathActions.mouseMove(x, y);
				
				break;
			case "textedit":
				x *= current_zoom;
				y *= current_zoom;
//					if (rubberBox && rubberBox.getAttribute('display') != 'none') {
//						svgedit.utilities.assignAttributes(rubberBox, {
//							'x': Math.min(start_x,x),
//							'y': Math.min(start_y,y),
//							'width': Math.abs(x-start_x),
//							'height': Math.abs(y-start_y)
//						},100);
//					}
				
				textActions.mouseMove(mouse_x, mouse_y);
				
				break;
			case "rotate":
				box = svgedit.utilities.getBBox(selected);
				cx = box.x + box.width/2;
				cy = box.y + box.height/2;
				var m = svgedit.math.getMatrix(selected),
					center = svgedit.math.transformPoint(cx, cy, m);
				cx = center.x;
				cy = center.y;
				angle = ((Math.atan2(cy-y, cx-x) * (180/Math.PI))-90) % 360;
				if (curConfig.gridSnapping) {
					angle = svgedit.utilities.snapToGrid(angle);
				}
				if (evt.shiftKey) { // restrict rotations to nice angles (WRS)
					var snap = 45;
					angle= Math.round(angle/snap)*snap;
				}

				canvas.setRotationAngle(angle<-180?(360+angle):angle, true);
				call("transition", selectedElements);
				break;
			default:
				break;
		}
		
		runExtensions("mouseMove", {
			event: evt,
			mouse_x: mouse_x,
			mouse_y: mouse_y,
			selected: selected
		});

	}
1202402
function (delay, evt) {
            var me = this;
            //有光标才做selectionchange 为了解决未focus时点击source不能触发更改工具栏状态的问题（source命令notNeedUndo=1）
//            if ( !me.selection.isFocus() ){
//                return;
//            }


            var hackForMouseUp = false;
            var mouseX, mouseY;
            if (browser.ie && browser.version < 9 && evt && evt.type == 'mouseup') {
                var range = this.selection.getRange();
                if (!range.collapsed) {
                    hackForMouseUp = true;
                    mouseX = evt.clientX;
                    mouseY = evt.clientY;
                }
            }
            clearTimeout(_selectionChangeTimer);
            _selectionChangeTimer = setTimeout(function () {
                if (!me.selection || !me.selection.getNative()) {
                    return;
                }
                //修复一个IE下的bug: 鼠标点击一段已选择的文本中间时，可能在mouseup后的一段时间内取到的range是在selection的type为None下的错误值.
                //IE下如果用户是拖拽一段已选择文本，则不会触发mouseup事件，所以这里的特殊处理不会对其有影响
                var ieRange;
                if (hackForMouseUp && me.selection.getNative().type == 'None') {
                    ieRange = me.document.body.createTextRange();
                    try {
                        ieRange.moveToPoint(mouseX, mouseY);
                    } catch (ex) {
                        ieRange = null;
                    }
                }
                var bakGetIERange;
                if (ieRange) {
                    bakGetIERange = me.selection.getIERange;
                    me.selection.getIERange = function () {
                        return ieRange;
                    };
                }
                me.selection.cache();
                if (bakGetIERange) {
                    me.selection.getIERange = bakGetIERange;
                }
                if (me.selection._cachedRange && me.selection._cachedStartElement) {
                    me.fireEvent('beforeselectionchange');
                    // 第二个参数causeByUi为true代表由用户交互造成的selectionchange.
                    me.fireEvent('selectionchange', !!evt);
                    me.fireEvent('afterselectionchange');
                    me.selection.clear();
                }
            }, delay || 50);
        }
165601
protected boolean startDrag(SVGPoint startPoint, Event evt) {
    if (listener != null) {
      return listener.startDrag(startPoint, evt);
    }
    return true;
  }
462407
function ( evt ) {
                if ( !$B.ua.FIREFOX ) {
                    this.offsetX = function ( evt ) { return evt.offsetX; };
                    //파폭
                } else {
                    this.offsetX = function ( evt ) { return evt.layerX - evt.currentTarget.offsetLeft; };
                }
                return this.offsetX( evt );
            }
841914
function(evts, callback, scope) {
			if(!$.isFunction(callback) || !evts) {
				//如果不是函数，或者evts为空，则直接返回
				//不抛出异常
				return this;
			}

			scope = scope || null; //回调作用域
			
			evts = $.isArray(evts) ? evts : evts.split(',');

			var uuid = getUUid();
			this.cbMap[uuid] = {
				fn: callback,
				scope: scope
			};
			this._cbMap[callback] = uuid;

			$.each(evts, function(e, i) {
				this.list[e] = this.list[e] || {
					handlers: [],
					//待处理的uuid
					data: '',
					state: 0
				};

				(this.uuid2Evts[uuid] = this.uuid2Evts[uuid] || []).push(e);

				this.list[e].handlers.push(uuid); //使用uuid记录
			}, this)


			return this;
		}