Page 6 of 6 FirstFirst ... 456
Results 51 to 56 of 56

Thread: Ext.draw.* Playground

  1. #51
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,425

    Default

    Quote Originally Posted by johanhaest View Post
    And I opened a ticket on the setViewBox in VML
    johanhaest, I saw the ticket, so thanks for entering it. Did you find a workaround for this defect?

  2. #52
    Sencha User
    Join Date
    Mar 2011
    Posts
    116

    Default

    Sadly no, we stopped supporting VML for a while. Since the deadline is too close to support both.
    And the rendering goes way faster in SVG.

    The only major things for me currently not working in VML are:
    • VML Stroke Opacity
    • setViewBox function not working

    These things work perfect in SVG

    I can't get these things to work by implementing them myself. I also would like the event contextmenu on a sprite but we currently have a fix for this ourselfs.

  3. #53
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    2,425

    Default

    I added to Ext.draw.Component cross-browser pan() and zoom() methods /w the ability to reset panning and zooming.

    Code:
    Ext.applyIf(Ext.draw.Component.prototype, {
    	// direction 't", 'b", 'l' or 'r'
    	// distance in pixels - int
    	// pan() means reset pan
    	pan: function (direction, distance) {
    		var me = this;
    		if (Ext.isDefined(direction)) {
    			me.surface.el.move(direction, distance || 75, true);
    		} else {
    			var el = me.surface.el,
    				position = el.getStyle("position");
    			if (position === 'relative') {
    				el.setStyle({
    					position: 'static',
    					top: 0,
    					left: 0
    				});
    			}		
    		}
    		return me;
    	},
    
    	reset: function () {
    		return this.pan().zoom();
    	},
    			
    	prevZoom: 1,		
    
    	// zoom(120) means zoom 120%
    	// zoom() means reset zoom
    	zoom: function (zoom) {
    		var me = this;  
    		function zoomFF(zoom) {
    			var size = me.getSize();
    			me.surface.setViewBox(0, 0, (size.width * 100) / zoom, (size.height * 100) / zoom);
    		}
    		function zoomWebKit(zoom) {
    			me.surface.el.setStyle({
    				WebkitTransform: 'scale(' + (zoom / 100) + ')',
    				WebkitTransformOrigin: '0 0',
    				zoom: zoom + '%'
    			});
    		}		
    		if (Ext.isDefined(zoom)) {		
    			zoom *= me.prevZoom;
    			me.prevZoom = zoom / 100;
    			var fn = Ext.isGecko ? zoomFF : zoomWebKit;
    			fn(zoom);
    		} else {
    			if (me.prevZoom !== 1) {
    				me.zoom(100 / me.prevZoom);
    				me.prevZoom = 1;
    			}		
    		}
    		return me;
    	},
    	
    	// not used, won't work in IE until bug [OPEN-EXTJSIV-1808] is fixed
    	setViewBox: function () {
    		var me = this,
    			bbox = me.surface.items.getBBox(),
    			width = bbox.width,
    			height = bbox.height,
    			x = bbox.x,
    			y = bbox.y;
    		me.surface.setViewBox(x, y, width + 5, height + 5);
    	}		
    });

  4. #54
    Sencha User
    Join Date
    Dec 2010
    Posts
    11

    Question

    Hi all,

    When playing with Ext.draw I stumbled upon this probable bug:
    http://www.sencha.com/forum/showthre...523#post602523

    Anybody that has a solution for this?

    I'm also wondering if the Ext.draw repository is public? Where can i find it?

    Greetings,
    Chielus

  5. #55
    Sencha User
    Join Date
    Mar 2011
    Posts
    116

    Default

    No it's not public.

    I think the problem here is that you made the click event on the surface and not the component itself. Therefore it gets fired everytime you click a sprite in the surface.

  6. #56
    Sencha User
    Join Date
    Dec 2010
    Posts
    11

    Default

    Quote Originally Posted by johanhaest View Post
    No it's not public.

    I think the problem here is that you made the click event on the surface and not the component itself. Therefore it gets fired everytime you click a sprite in the surface.
    When registring it on the drawComponent, it's the same problem:
    Code:
    drawComponent.on('click', function(){ .....});

Page 6 of 6 FirstFirst ... 456

Similar Threads

  1. Replies: 1
    Last Post: 18 Mar 2011, 9:35 AM
  2. HTML 5 Playground by Google
    By aw1zard2 in forum Community Discussion
    Replies: 1
    Last Post: 30 Jun 2010, 3:58 AM
  3. Canvas Playground
    By steffenk in forum Community Discussion
    Replies: 1
    Last Post: 20 Apr 2010, 3:47 PM
  4. Ext Playground
    By ry.extjs in forum Community Discussion
    Replies: 4
    Last Post: 3 Apr 2009, 3:36 PM
  5. Grid Playground
    By steffenk in forum Community Discussion
    Replies: 13
    Last Post: 28 Sep 2007, 3:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •