@nativescript-community/ui-chart
Version:
A powerful chart / graph plugin, supporting line, bar, pie, radar, bubble, and candlestick charts as well as scaling, panning and animations.
36 lines • 1.3 kB
JavaScript
import { ObjectPool } from '../utils/ObjectPool';
import { Utils } from '../utils/Utils';
import { ViewPortJob } from './ViewPortJob';
/**
* Created by Philipp Jahoda on 19/02/16.
*/
export class MoveViewJob extends ViewPortJob {
static getInstance(viewPortHandler, xValue, yValue, trans, v) {
const result = pool.get();
result.mViewPortHandler = viewPortHandler;
result.xValue = xValue;
result.yValue = yValue;
result.transformer = trans;
result.mView = v;
return result;
}
static recycleInstance(instance) {
pool.recycle(instance);
}
constructor(viewPortHandler, xValue, yValue, trans, v) {
super(viewPortHandler, xValue, yValue, trans, v);
}
run() {
const pts = Utils.getTempArray(2);
pts[0] = this.xValue;
pts[1] = this.yValue;
this.transformer.pointValuesToPixel(pts);
this.mViewPortHandler.centerViewPort(pts, this.mView);
MoveViewJob.recycleInstance(this);
}
instantiate() {
return new MoveViewJob(this.mViewPortHandler, this.xValue, this.yValue, this.transformer, this.mView);
}
}
const pool = ObjectPool.create(2, new MoveViewJob(null, 0, 0, null, null)).setReplenishPercentage(0.5);
//# sourceMappingURL=MoveViewJob.js.map