-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix indexing example for feature animation #72
Comments
@Siedlerchr (CC: @smellman) By the way, are you still working on this example ? Because during checking examples of PR #84, I encountered the difference of feature animation example beween official and this repo.
But above issue may be my local environment specific one, so if it's no problem on your environments, just ignore this comment. 🙇♂️ Thanks, |
The example compiles but at runtime I stilll get that exception you posted earlier. Not exactly sure how to solve this, might be some webpack whatever thingy |
Okay, thanks for confirmation. --- a/examples/animation/map.featureanimation.ts
+++ b/examples/animation/map.featureanimation.ts
@@ -10,6 +10,15 @@ import { Coordinate } from 'ol/coordinate';
import 'ol-ext/render/AnimExtent';
import featureAnimation from 'ol-ext/featureanimation/FeatureAnimation';
import { getKey } from 'ol/tilecoord';
+
+declare global {
+ interface Window {
+ $(selector: any, context?: any): any,
+ add10(): void
+ }
+}
+const $ = window.$;
+
// Layers
let layer = new TileLayer({
source: new Stamen({ layer: 'terrain' }),
@@ -113,12 +122,12 @@ function addFeatureAt(p: Coordinate) {
vector.getSource()?.addFeature(f);
vector.animateFeature(f, [
- new featureAnimation[$('#anim').text()] ({
+ new featureAnimation[$('#anim').val()] ({
speed: Number($('#speed').val()),
duration: Number(1000 -Number($('#speed').val()) * 300),
side: $('#side').prop('checked'),
}),
- new featureAnimation[$('#anim2').text()]({
+ new featureAnimation[$('#anim2').val()]({
speed: Number($('#speed').val()),
duration: Number(1000 - Number($('#speed').val()) * 300),
horizontal: /Slide/.test($('#anim').text()),
@@ -139,6 +148,9 @@ function add10() {
}, 100 * i);
}
}
+window.add10 = (): void => {
+ add10();
+}
add10();
// Drop a feature on click
@@ -154,7 +166,7 @@ map.on('singleclick', function (evt) {
vector.getSource()?.removeFeature(f);
// Show animation
vector.animateFeature(f, [
- new featureAnimation[$('#anim').text()]({
+ new featureAnimation[$('#anim').val()]({
speed: Number($('#speed').val()),
duration: Number(1000 - Number($('#speed').val()) * 300),
side: $('#side').prop('checked'), Anyway, the example is not the first priority than types, so later fix will be enough. |
No description provided.
The text was updated successfully, but these errors were encountered: