小编Jor*_*ost的帖子

地图加载后切换 Mapbox GL JS 地图交互性

创建地图后可以更改地图是否是交互式的吗?

在 mapbox-gl-js 文档中,只能在创建地图时将地图标记为交互式或非交互式(option.interactive)。但由于某些原因,我需要即时更改它并切换地图交互性。就像是:

map.setInteractive(true);
Run Code Online (Sandbox Code Playgroud)

或者:

map.setInteractive(false);
Run Code Online (Sandbox Code Playgroud)

感谢您的支持。

javascript mapbox-gl mapbox-gl-js

4
推荐指数
1
解决办法
1501
查看次数

使用-setClip方法重新绘制自定义视图上的插入NSShadow

我有奇怪的问题,与这个问题的答案有关:

绘制插入NSShadow和插入笔划

我将此代码用于自定义视图的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)

cocoa drawing nsbezierpath nsshadow

2
推荐指数
1
解决办法
1472
查看次数