Problem with PictureFillSymbol in 4.2

824
3
02-27-2017 06:53 AM
JonCrain
New Contributor II

I'm having issues with PictureFillSymbol.  

Using this code

var polygon = new Polygon({
    rings: [
        [
            [-97.06138, 32.837, 0],
            [-100.06133, 35.836, 0],
            [-100.06124, 32.834, 0],
            [-97.06138, 32.837, 0]
        ], [
            [0, 0, 0],
            [0, 0, 0],
            [0, 0, 0],
            [0, 0, 0]
        ]
    ],
    hasZ: false,
    hasM: false,
    spatialReference: { wkid: 4326 }
});

// This works
// var fillSymbol = new SimpleFillSymbol({
//   color: new Color([227, 139, 79, 0.8]),
//   outline: { // autocasts as new SimpleLineSymbol()
//     color: new Color([255, 255, 255]),
//     width: 1
//   }
// });

// This gives an error
var fillSymbol = new PictureFillSymbol({
    url: url,
    width: 12,
    height: 12,
    xoffset: 0,
    xscale: 1,
    yoffset: 0,
    yscale: 1,
    outline: {
        color: new Color([255, 255, 255]),
        width: 1
    }
});

var polygonGraphic = new Graphic({
    geometry: polygon,
    symbol: fillSymbol
});

layer.add(polygonGraphic);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I get this error

Uncaught TypeError: Right-hand side of 'instanceof' is not an object
    at b.l._getParentSurface (MapView.js:333)
    at b.l._setFillObject (MapView.js:333)
    at b.l.setFill (MapView.js:330)
    at Object.m.styleShape (MapView.js:381)
    at f.render (MapView.js:368)
    at d.renderChild (MapView.js:364)
    at d.renderChildren (MapView.js:259)
    at d.render (MapView.js:255)
    at m.renderChild (MapView.js:290)
    at m.d.renderChildren (MapView.js:259)‍‍‍‍‍‍‍‍‍‍‍

I've tried this with a couple different pictures including locally hosted ones and external ones, same error.  I've logged all the objects and they all seem to be created fine, there's just this error on render.

0 Kudos
3 Replies
KellyHutchins
Esri Frequent Contributor

It looks like there may be an issue with the PFS at 4.2 that is fixed in the next release.  Just to verify can you try this PFS code in your test app? 

symbol: new PictureFillSymbol({
url: "https://goo.gl/58GeAx",
width: 240,
height: 240
})

0 Kudos
JonCrain
New Contributor II

I inserted your code into my test app and received the same error.

Thanks for looking into it.

0 Kudos
KellyHutchins
Esri Frequent Contributor

Great thanks for confirming. This will be fixed in the next release due out soon. 

0 Kudos