(未定义的参考文献:未定义默认交互式)如何添加“翻译功能”。在ASP.NET CORE5中的我的OpenLayers6项目中
我是开放层的新手。当我使用node.js时,我的代码工作正常。但是,当我切换到ASP.NET核心时,我遇到了一些问题。
我了解到,当调用模块在ASP.NET Core中使用它们时,我需要在其头部添加一些前缀。
例如,能够使用“映射”模块:
const map = new ol.Map({ });
但是我不知道我应该在“ defaultInteractions()” 之前添加哪个前缀,这
interactions: defaultInteractions().extend([select, translate]),
是我的 map 代码段
const map = new ol.Map({
interactions: defaultInteractions().extend([select, translate]),
layers: [
new ol.layer.Image({
source: new ol.source.ImageStatic({
url: 'https://imgs.xkcd.com/comics/online_communities.png',
projection: projection,
imageExtent: extent,
}),
}),
rasterLayer, vectorLayer
],
target: 'map',
view: new ol.View({
projection: projection,
center: ol.extent.getCenter(extent),
zoom: 2,
maxZoom: 8,
}),
});
时,当我ctrl +左键单击 defaultInteraction(), ol.interaction.js page 打开时,
当我ctrl + ctrl +左键单击 extend([[[[[选择,翻译]) ol.collection.js页面打开。
但是两者都没有起作用。
祝您有美好的一天<(^。^)>
I'm new to Openlayers. While I was using Node.js, my codes were working fine. But I ran into some problems when I switched to Asp.Net Core.
I learned that when calling modules to use them in Asp.Net Core I need to add some prefixes to their heads.
For example to be able to use the "Map" module:
const map = new ol.Map({ });
But I don't know what prefix I should add before "defaultInteractions()" in this line
interactions: defaultInteractions().extend([select, translate]),
Here is my Map code snippet
const map = new ol.Map({
interactions: defaultInteractions().extend([select, translate]),
layers: [
new ol.layer.Image({
source: new ol.source.ImageStatic({
url: 'https://imgs.xkcd.com/comics/online_communities.png',
projection: projection,
imageExtent: extent,
}),
}),
rasterLayer, vectorLayer
],
target: 'map',
view: new ol.View({
projection: projection,
center: ol.extent.getCenter(extent),
zoom: 2,
maxZoom: 8,
}),
});
When I ctrl + left click on defaultInteraction(), the ol.interaction.js page opens,
When I ctrl + left click on extend([select, translate]) the ol.Collection.js page opens.
But both are not working.
Thanks in advance and have a good day <(^.^)>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
[已解决]
我将行更改为:
[solved]
I changed the line to:
注意:
使用
ol.Interaction.defaults.defaults()。Extent()
Notice:
Using
ol.interaction.defaults.defaults().extend()