BLOG
|
I've made some adjustments to the widget. I started by translating everything to Swedish, I thought about replacing hardcoded text and making the widget translatable by the book, but it was a bit much so I took the quick route of just changing hardcoded text, which makes it pretty pointless to share my code here. But I'll try to describe the changes I made for a couple of specific featuresin case anyone finds it useful. Buggfix: When user have an active draw tool and clear all graphics, the draw tools gets inactive but the button is still selected so it looks like the drawtool should be selected. In widget.tsx function ”drawClearBtnClick” either remove the line ” this.sketchViewModel.cancel();” this was my choice, or make sure to disable all buttons. Added a draw arrow tool: Make a copy of everything for drawing a polyline but change name to draw arrow or something, and add ’arrow’ to the list of possible drawtools. In the function ”setDrawToolBtnState” ad a case to the switch(toolBtn) for arrow case 'arrow':
cState.currentSymbol = this.sketchViewModel.polylineSymbol;
cState.currentSymbolType = JimuSymbolType.Polyline;
this.sketchViewModel.polylineSymbol.marker = {
color: cState.currentSymbol.color,
placement: 'end',
style: 'arrow'
}
if(this.state.arrowBtnActive){
this.sketchViewModel.cancel();
}else{
this.sketchViewModel.create("polyline");
cState.arrowBtnActive = true;
}
break; where we’re adding an arrow marker at the end of the line with the same color as the line. To make sure there are no arrows added to polylines drawn after the user has drawn an arrow we have to add this.sketchViewModel.polylineSymbol.marker = null; to the polyline and freepolyline cases. To make sure the arrow doesn’t disappear when editing symbology of an existing line I added this code: if(this.state.currentTool === 'arrow'){
this.sketchViewModel.polylineSymbol.marker = {
color: evt.color,
placement: 'end',
style: 'arrow'
}
} else {
this.sketchViewModel.polylineSymbol.marker = null;
} to the onPolylineSymbolChanged function. Rotate segment measurements along lines: I prefer segment measurements to be rotated along the segment lines, but obviously not upside down. I gave it a try and managed to accomplish something that works fairly well. All modifications where made in measure.tsx I added a new parameter called ‘angle’ to the function “_addMeasurement” const _addMeasurement = async (graphic: ExtendedGraphic, parentGraphic = null, angle:number = null) => { And after this code (in that function) //for new graphics } else { //copy textSymbol and insert measurement text const textSymbol = currentTextSymbol.clone() textSymbol.text = text I added: //If angle is passed, it is a segment mesurement and we will set rotation and override text vertical alignment and set offset based on angle.
if(angle !== null){
textSymbol.angle = angle
textSymbol.verticalAlignment = 'bottom'
//calculate offset depending on angle
const distance = 4
const angleRad = angle * Math.PI / 180;
const perpendicular = angleRad + Math.PI / 2;
textSymbol.yoffset = Math.sin(perpendicular) * distance;
textSymbol.xoffset = Math.cos(perpendicular) * distance * -1.5;
} I wrote a new function called _calculateAngle to calculate the angle/rotation const _calculateAngle = (x1:number, y1:number, x2:number, y2:number) => {
const dx = x2 - x1;
const dy = y2 - y1;
const angleRad = Math.atan2(dy, dx);
let angleDeg = angleRad * -180 / Math.PI;
if (angleDeg > 90 || angleDeg < -90) {
angleDeg = (angleDeg + 180) % 360;
}
return angleDeg
} And makes call to that function and passes the angle three times in the liveMeasure function. //make a templine for each segment and add a measurement for it for (let j = 1; j < pointArray.length; j++) { const tempGraphic = makeTempLineGraphic(pointArray[j - 1], pointArray[j], geometry) const angle = _calculateAngle(pointArray[j - 1][0], pointArray[j - 1][1], pointArray[j][0], pointArray[j] [1]) _addMeasurement(tempGraphic, graphic, angle) } //line must have at least two points if (geometry.paths[0].length > 1) { const lastPoint = geometry.paths[0][geometry.paths[0].length - 1] const nextToLastPoint = geometry.paths[0][geometry.paths[0].length - 2] const tempGraphic = makeTempLineGraphic(nextToLastPoint, lastPoint, geometry) const angle = _calculateAngle(nextToLastPoint[0], nextToLastPoint[1], lastPoint[0], lastPoint[1]) _addMeasurement(tempGraphic, graphic, angle) } //calculate polygon segments } else { const rings = geometry.rings for (let i = 0; i < rings.length; i++) { const ring = rings[i] for (let j = 1; j < ring.length; j++) { const tempGraphic = makeTempLineGraphic(ring[j - 1], ring[j], geometry) const angle = _calculateAngle(ring[j - 1][0], ring[j - 1][1], ring[j][0], ring[j][1]) _addMeasurement(tempGraphic, graphic, angle) } }
... View more
3 weeks ago
|
2
|
0
|
570
|
BLOG
|
Hi @Brian_McLeer, At first I really liked the idea of the IDE telling me as I type if the code is correct or not. I missed that in WAB development coming from Flex and actions script years ago, but I'm starting to question ESLint because it's lying to me. Apart from all the problems in this widget code that I can just ignore, my first addition is a new draw style to draw arrows. It's really just a copy of the polyline tool, but it adds an arrow marker at the end of the line. ESLint is telling me that there is no marker property on the SimpleLineSymbol, but the documentation says it's been there since ArcGIS Maps SDK for JavaScript 4.16 , pretty annoying...
... View more
08-28-2025
12:21 AM
|
1
|
0
|
947
|
BLOG
|
Thanks for this widget that solves a lot of missing functionality in the draw widget! I still need to customize it a bit, mainly translating to Swedish, but also some minor UI adjustments and maybe adding some new functionality if I succeed. However when adding this wdget code to my Visual Studio Code project I get 280 problems only in the widget.tsx file. The code seems to be working fine but I think it is ESLint that has a lot of complaints. I set up my developement enviroment accorrding to the documentation here: https://developers.arcgis.com/experience-builder/guide/getting-started-widget/ inclunding ESLint. Do you guys use ESLint? and if so, how do you handle all the problems and warnings?
... View more
08-26-2025
02:22 AM
|
0
|
0
|
1043
|
POST
|
@inedecubber I'm not sure if I'm missing something here but isn't what you are doing here exactly what ExB is doing for you if you follow @Shen_Zhang s description in an earlier post here?
... View more
08-25-2025
02:03 AM
|
0
|
0
|
292
|
IDEA
|
I was thinking of connecting the list to your "Feature Layer that has 19 different Named Features" and just show the names and using it as a navigation widget if that gives you the actions you need to filter data etc.
... View more
08-18-2025
11:43 PM
|
0
|
1
|
290
|
IDEA
|
Have you tried using the list widget to the left instead of Views Navigation Widget? The list widget is very flexible and I think you can make it look like your navigation widget looks like now. And it has more actions, like filter action etc.
... View more
08-18-2025
12:05 AM
|
0
|
1
|
316
|
POST
|
Is there any news to this problem? I agree with @Philip_Ohlinger about problems when printing. But it is also that we use our own basemaps that are cached in certain scales and thats the scales they look the best, they can get a bit blurry when the zooming doesn't follow the maps scale levels. My users are also used to have the current map scale visible as text, so I've made a widget for that, but that gets messy with scales like 1:857339 instead of 1:400000.
... View more
04-29-2025
01:38 AM
|
0
|
0
|
611
|
IDEA
|
@OwenGeo I assume you mean if we had an equivalent block in ordinary Stories that actually shows in the published story? In that case it could meet our use case, but I would like to be able remove or config the "i-symbol" in the corner and be able to use at least a couple of different background colors.
... View more
04-28-2025
01:19 AM
|
0
|
0
|
434
|
BLOG
|
@DanHaaskenI'm not there yet and haven't tried editing in the Experience Builder yet. But I've bookmarked this blog post https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/from-the-smart-editor-to-smart-forms It seems like there's a new approach to some of the smart editing features, by setting up smart forms in the map viewer. You may have already read it, otherwise it might be worth checking out. But of course it is mainly form-based functions and does not solve all the different editing functions.
... View more
04-23-2025
12:25 AM
|
0
|
0
|
1019
|
POST
|
I've already kudos that idea! 😀 I'm guessing that 1.17 will be what comes with Enterprise 11.5, and that is the last version to support WAB, so I think I will be working with 1.17 for a long time before we have all our customized WAB widgets ported to ExB.
... View more
04-14-2025
06:18 AM
|
0
|
0
|
295
|
POST
|
I want to use a sidebar to hide/show the table widget in my application. When using map layers widget and the action "add to table" the layers table is added to the table, but still doesn't show up because the sidebar is collapsed. I haven't found any way to configure this in the ExB, I'm trying to fix it with a custom version of map-layers in developer edition, but I'm stuck. Customizing the map layers widget was probably not the smartest thing to start with as my first task with the developer edition. But I have managed to customize the information action as well as implement some of the features from Brian_McLeers Map Layers Widget Custom 1.17 and have managed to open my sidebar, but not from the right action. I have code to identify and open the sidebar, but right now it is running from a function that is called when the entire action menu is opened. It seems that there are different types of actions, those specific to the map layers widget, like info/details and other "data actions" like "add to table" and I can't find any function that is triggered when the user clicks on "add to table". I'm guessing that it doesn't even happen in the map layers widget but rather is handled by data actions somewhere else? But is there any way I can get my code to open the sidebar to run on the 'add to table' action without changing more places than in my custom map layers widget?
... View more
04-14-2025
04:49 AM
|
2
|
2
|
327
|
DOC
|
I've just started looking in to the developer version trying to learn typscript, react and everything so I'm not ready for this task yet 😀 But I would like to add two requests for features that we have in our WAB-application Save/export drawings to file and of course load/import. possibility to change symbology on already drawn graphics
... View more
04-11-2025
05:03 AM
|
0
|
0
|
1061
|
POST
|
@Jamie_Leitch_CNFwe have a single server deployment, so we didn't have to think about that. But I'd guess it would be just the ArcGIS Server machine that need the changes.
... View more
03-31-2025
11:46 PM
|
0
|
1
|
899
|
POST
|
@Jamie_Leitch_CNF I haven't done very extensive testing, but what I've tested has worked and I haven't heard from any users who have had problems after the changes yet.
... View more
03-31-2025
02:46 AM
|
0
|
3
|
929
|
POST
|
We did this: Disable the use of llvmpipe by adding this virtual machine config option to the VM's VMX file: guestinfo.svga.disableLLVMPipe=TRUE Set a system environment variable SVGA_ALLOW_LLVMPIPE=0 Which seems to have solved the problem.
... View more
03-28-2025
06:21 AM
|
0
|
0
|
984
|
Title | Kudos | Posted |
---|---|---|
1 | 01-13-2025 02:57 AM | |
2 | 04-14-2025 04:49 AM | |
2 | 3 weeks ago | |
1 | 08-28-2025 12:21 AM | |
1 | 02-24-2025 05:29 AM |
Online Status |
Offline
|
Date Last Visited |
11 hours ago
|