在Leaflet 0.7中,此代码使所有线串都无法点击:
typedef NS_ENUM (NSInteger, OBDTraitStyle) {
OBDTraitStyleCompact,
OBDTraitStyleMedium,
OBDTraitStyleFull
};
static NSNumber *_previousGlobalTraitStyleNumber = nil;
@implementation UITraitCollection (OBD)
- (OBDTraitStyle)obd_traitStyle
{
UIApplicationState state = [[UIApplication sharedApplication] applicationState];
if (state == UIApplicationStateBackground)
{
if (_previousGlobalTraitStyleNumber != nil)
{
NSLog(@"App in background - returning previous trait style: %ld", (long)[_previousGlobalTraitStyleNumber integerValue]);
return [_previousGlobalTraitStyleNumber integerValue];
}
else
{
NSLog(@"App in background - cannot return previous trait style, as it doesn't exist");
}
}
OBDTraitStyle traitStyle = 0;
if (self.horizontalSizeClass == UIUserInterfaceSizeClassCompact)
{
traitStyle = OBDTraitStyleCompact;
}
else
{
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
if (window.traitCollection.horizontalSizeClass == UIUserInterfaceSizeClassCompact)
{
traitStyle = OBDTraitStyleCompact;
}
else
{
CGSize viewSize = window.bounds.size;
BOOL horizontalExpanded = (viewSize.width > 768);
if (horizontalExpanded == NO)
{
traitStyle = OBDTraitStyleMedium;
}
else
{
traitStyle = OBDTraitStyleFull;
}
}
}
_previousGlobalTraitStyleNumber = @(traitStyle);
return traitStyle;
}
@end
这 - clickable:false - 在Leaflet中不起作用1.如何制作不可忽略的线串?
答案 0 :(得分:1)
在Leaflet 1.0.0中,interactive
选项已重命名为更合适interactive
。
将true
选项设置为false
的图层将对各种鼠标/指针事件做出反应,而不仅仅是点击。如果设置为L.Marker
,它将对任何一个做出反应。
如果您在http://leafletjs.com/reference-1.0.3.html查看当前的宣传单文档,您会发现大多数图层(包括L.Polyline
和interactive
等)都有L.GridLayer
选项。您可以在“从交互层继承的选项”部分找到它。
另请注意,L.TileLayer
和private val firms: mutable.Map[String, Integer] = ...
private val firmIdFromCode: (String => Integer) = (code: String) => firms(code)
val firm_id_by_code: UserDefinedFunction = udf(firmIdFromCode)
...
val ds = dataset.withColumn("firm_id", firm_id_by_code($"firm"))
不具有该选项,且无法进行互动。
答案 1 :(得分:1)
也许您可以使用 off()
函数或别名 removeEventListener()
(请参阅 https://leafletjs.com/reference-1.7.1.html#evented-off)。这可以删除所有注册到点击事件的事件监听器,即:
highlightLayer.removeEventListener('click');
我刚刚有一个类似的用例,我需要防止弹出窗口在实际打开时重新打开。我想知道为什么在过去四年中从未提出过这种解决方案。