Skip to content

Commit

Permalink
enable to run index signature
Browse files Browse the repository at this point in the history
  • Loading branch information
smellman committed Apr 11, 2022
1 parent cc19846 commit 5479b48
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 6 additions & 6 deletions @types/ol-ext/featureanimation/FeatureAnimation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export interface FeatureAnimationEvent {
style: StyleLike
}
export interface Options {
speed?: Number;
duration?: number;
revers?: boolean;
repeat?: number;
hiddenStyle?: Style;
side?: boolean;
horizontal?: boolean;
fade?: ((p0: number) => number);
easing?: ((p0: number) => number);
}
interface IObjectKeys {
[key: string]: string | number | undefined;
}

/** An animation controler object an object to control animation with start, stop and isPlaying function.
* To be used with {@link olx.Map#animateFeature} or {@link layer.Vector#animateFeature}
Expand Down Expand Up @@ -66,11 +66,9 @@ export type animationControler = {
* @param {easing.Function} options.fade an easing function used to fade in the feature, default none
* @param {easing.Function} options.easing an easing function for the animation, default easing.linear
*/
export default class featureAnimation extends _OL_OBJECT {
export class FeatureAnimation extends _OL_OBJECT {
constructor(options?: Options);

[key: string]: any;

/** Function to perform manipulations onpostcompose.
* This function is called with an featureAnimationEvent argument.
* The function will be overridden by the child implementation.
Expand All @@ -82,3 +80,5 @@ export default class featureAnimation extends _OL_OBJECT {
animate(e: FeatureAnimationEvent): boolean;
}

export const featureAnimation: { [key:string]: typeof FeatureAnimation}
export default featureAnimation
12 changes: 4 additions & 8 deletions examples/animation/map.featureanimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,9 @@ function addFeatureAt(p: Coordinate) {
break;
}

//TODO: Indexing does not yet work
/*
vector.getSource().addFeature(f);
vector.getSource()?.addFeature(f);
vector.animateFeature(f, [
new featureAnimation[$('#anim2').text()] ({
new featureAnimation[$('#anim').text()] ({
speed: Number($('#speed').val()),
duration: Number(1000 -Number($('#speed').val()) * 300),
side: $('#side').prop('checked'),
Expand All @@ -130,7 +128,7 @@ function addFeatureAt(p: Coordinate) {

// Add 10 random features
function add10() {
vector.getSource().clear();
vector.getSource()?.clear();
let ex = map.getView().calculateExtent(map.getSize());
for (let i = 0; i < 10; i++) {
setTimeout(function () {
Expand All @@ -153,7 +151,7 @@ map.on('singleclick', function (evt) {
});
if (f) {
// Remove feature
vector.getSource().removeFeature(f);
vector.getSource()?.removeFeature(f);
// Show animation
vector.animateFeature(f, [
new featureAnimation[$('#anim').text()]({
Expand All @@ -169,5 +167,3 @@ map.on('singleclick', function (evt) {


});
*/
}

0 comments on commit 5479b48

Please sign in to comment.