From 20cf1a55897572b160426148d915e134c18bab8a Mon Sep 17 00:00:00 2001 From: steveoh Date: Wed, 28 Oct 2020 12:48:31 -0600 Subject: [PATCH] fix: remove all references to esri loader --- src/components/Identify/Identify.js | 20 ++++++++++---------- src/components/esrijs/Print.js | 5 +---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/components/Identify/Identify.js b/src/components/Identify/Identify.js index 2822921d..f15c10c2 100644 --- a/src/components/Identify/Identify.js +++ b/src/components/Identify/Identify.js @@ -4,9 +4,8 @@ import './Identify.css'; import { Container, Col } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'; - +import {project, isLoaded, isSupported, load} from '@arcgis/core/geometry/projection'; import Helpers from '../../Helpers'; -import { loadModules } from 'esri-loader'; class IdentifyInformation extends Component { state = { @@ -302,16 +301,17 @@ class IdentifyInformation extends Component { } async projectPoint(mapPoint, srid) { - const [projection] = await loadModules(['esri/geometry/projection']); - // lat/long coords - console.log("loaded: ", projection.isLoaded()); - console.log("supported: ", projection.isSupported()); - - await projection.load(); + if (!isSupported) { + console.warn('projection not supported'); + return; + } - console.log(projection.isLoaded()); + // lat/long coords + if (!isLoaded()) { + await load(); + } - return projection.project(mapPoint, { wkid: srid }); + return project(mapPoint, { wkid: srid }); } } diff --git a/src/components/esrijs/Print.js b/src/components/esrijs/Print.js index b9a90b8e..735eebcd 100644 --- a/src/components/esrijs/Print.js +++ b/src/components/esrijs/Print.js @@ -1,6 +1,5 @@ import React, { Component } from 'react'; -import { loadModules } from 'esri-loader'; - +import Print from '@arcgis/core/widgets/Print'; export default class Printer extends Component { render() { @@ -10,8 +9,6 @@ export default class Printer extends Component { } async componentDidMount() { - const [Print] = await loadModules(['esri/widgets/Print']); - if (this.printer) { return; }