创建地图后可以更改地图是否是交互式的吗?
在 mapbox-gl-js 文档中,只能在创建地图时将地图标记为交互式或非交互式(option.interactive)。但由于某些原因,我需要即时更改它并切换地图交互性。就像是:
map.setInteractive(true);
Run Code Online (Sandbox Code Playgroud)
或者:
map.setInteractive(false);
Run Code Online (Sandbox Code Playgroud)
感谢您的支持。
我有奇怪的问题,与这个问题的答案有关:
我将此代码用于自定义视图的drawRect方法.我有这个:
- (void)drawRect:(NSRect)rect
{
// Create and fill the shown path
NSBezierPath *path = [NSBezierPath
bezierPathWithRoundedRect:[self bounds]
xRadius:4.0f
yRadius:4.0f];
[[NSColor colorWithCalibratedWhite:0.8f alpha:0.2f] set];
[path fill];
// Save the graphics state for shadow
[NSGraphicsContext saveGraphicsState];
// Set the shown path as the clip
[path setClip];
// Create and stroke the shadow
NSShadow * shadow = [[[NSShadow alloc] init] autorelease];
[shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0f alpha:0.8f]];
[shadow setShadowBlurRadius:2.0];
[shadow set];
[path stroke];
// Restore the graphics state
[NSGraphicsContext restoreGraphicsState];
if ( highlight …Run Code Online (Sandbox Code Playgroud)