Phil 10.31.11

7:30 – 4:30 VISIBILITY

  • Lots of paperwork today.
  • Was finally able to add status to the server blog
  • Got the last bits of the scaling/translation math working:
	private var _newButtonDown:Boolean = true;

	private function init():void{
		listenerGroup.addEventListener(MouseEvent.MOUSE_WHEEL, handleMove);
		listenerGroup.addEventListener(MouseEvent.MOUSE_MOVE, handleMove);
		_xpos = chart.width/2;
		_ypos = chart.height/2;
		_scaledWidth = chart.width;
		_scaledHeight = chart.height;

		handleZoom(null);
	}

	private function handleZoom(event:Event):void{
		_scalar = scaleSlider.value;
		var m:Matrix = chart.getLayoutMatrix();

		m.a = _scalar;
		m.d = _scalar;
		var s:Number = chart.width*_scalar;
		_scaledWidthDelta = s - _scaledWidth;
		_scaledWidth = s;
		s = chart.height*_scalar;
		_scaledHeightDelta = s - _scaledHeight;
		_scaledHeight = s;

		m.tx += -_scaledWidthDelta*0.5;
		m.ty += -_scaledHeightDelta*0.5;
		_dx = m.tx;
		_dy = m.ty;

		chart.setLayoutMatrix(m, true);
	}

	private function handleMove(evt:MouseEvent):void{
		var m:Matrix = chart.getLayoutMatrix();

		if(evt.buttonDown){
			if(_newButtonDown){
				_newButtonDown = false;
				_xpos = evt.stageX-_dx;
				_ypos = evt.stageY-_dy;
			}
			_dx = evt.stageX - _xpos;
			_dy = evt.stageY - _ypos;
		}else{
			_newButtonDown = true;
			return;
		}

		m.a = _scalar;
		m.d = _scalar;

		m.tx = _dx;
		m.ty = _dy;
		chart.setLayoutMatrix(m, true);
	}
  • Next, incorporate into Mobile code.
  • Before that, fixing the multiple select from search bug in GenericScroller