PHP Classes

File: web/bundles/extjs/src/draw/SpriteDD.js

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/bundles/extjs/src/draw/SpriteDD.js   Download  
File: web/bundles/extjs/src/draw/SpriteDD.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 3,016 bytes
 

Contents

Class file image Download
/* This file is part of Ext JS 4.2 Copyright (c) 2011-2013 Sencha Inc Contact: http://www.sencha.com/contact GNU General Public License Usage This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314) */ /** * DD implementation for Panels. * @private */ Ext.define('Ext.draw.SpriteDD', { extend: 'Ext.dd.DragSource', constructor : function(sprite, cfg){ var me = this, el = sprite.el; me.sprite = sprite; me.el = el; me.dragData = {el: el, sprite: sprite}; me.callParent([el, cfg]); me.sprite.setStyle('cursor', 'move'); }, showFrame: Ext.emptyFn, createFrame : Ext.emptyFn, getDragEl : function(e){ return this.el; }, getRegion: function() { var me = this, el = me.el, pos, x1, x2, y1, y2, t, r, b, l, bbox, sprite; sprite = me.sprite; bbox = sprite.getBBox(); try { pos = Ext.Element.getXY(el); } catch (e) { } if (!pos) { return null; } x1 = pos[0]; x2 = x1 + bbox.width; y1 = pos[1]; y2 = y1 + bbox.height; return new Ext.util.Region(y1, x2, y2, x1); }, /* TODO(nico): Cumulative translations in VML are handled differently than in SVG. While in SVG we specify the translation relative to the original x, y position attributes, in VML the translation is a delta between the last position of the object (modified by the last translation) and the new one. In VML the translation alters the position of the object, we should change that or alter the SVG impl. */ startDrag: function(x, y) { var me = this, attr = me.sprite.attr; me.prev = me.sprite.surface.transformToViewBox(x, y); }, onDrag: function(e) { var xy = e.getXY(), me = this, sprite = me.sprite, attr = sprite.attr, dx, dy; xy = me.sprite.surface.transformToViewBox(xy[0], xy[1]); dx = xy[0] - me.prev[0]; dy = xy[1] - me.prev[1]; sprite.setAttributes({ translate: { x: attr.translation.x + dx, y: attr.translation.y + dy } }, true); me.prev = xy; }, setDragElPos: function () { // Disable automatic DOM move in DD that spoils layout of VML engine. return false; } });