Add multiple scales to the scale overlay?

Product: Webviewer

Product Version: 10.7

Please give a brief summary of your issue:
We are trying to add multiple scales to the scale overlay when instantiating webviewer or when opening a document, similar to the “add new scale” button here :
image

We know how to add preset scales, but this is not what we are looking for.
The setStyle method as seen in Measurement-tools | Apryse Documentation only allows one scale to be set.

How can we achieve this?

1 Like

Hi there,

Currently, only one scale is applied at a time for a measurement tool, you can see this as calling createAndApplyScale API multiple times will override the older scale
https://docs.apryse.com/api/web/Core.MeasurementManager.html#createAndApplyScale__anchor

We will add a feature request for this item to be reviewed by the product team. Please keep an eye out for the changelogs Changelog | Apryse Documentation

Best regards,
Kevin Kim

2 Likes

Thanks kkim,

We are looking forward to be able to set multiple scales. I hope this can be added in the backlog.

1 Like

Hi @kkim
I’ve been trying to implement this as well and came across this support ticket. Do you have any indication of when this is likely to be added?
Thanks,
Chris

1 Like

Hello Chris,

Thank for you contacting WebViewer Forums.

Currently there is no timeline for this feature request. However, I would be happy to add more interest onto the existing request for visibility.

Regards,
Luke

1 Like

Hello,

Please add more interest onto the request to allow us to add multiple scales with measurement manager’s createAndApplyScale method.

I’ve also found that when I make this call, the scale overlay doesn’t update immediately. The new scale only appears in the dropdown menu after a page refresh. Is this expected? Happy to receive a proper sample on how to use this createAndApplyScale method properly.

Using WebViewer v11.1.0

Thanks,
Makoa

1 Like

Hello Makoa,

Thank you for your feedback. I have updated this feature request with your interest in adding multiple scales.

To use the createAndApplyScale, the applyTo portion will have the updated scales. In the example, the Ellipse tool will have the updated scale. This operation can be initialized during a documentLoaded event for example which triggers when a new document is loaded into the Viewer:

const measurementManager =
  instance.Core.documentViewer.getMeasurementManager();

const tool = instance.Core.documentViewer.getTool(
  'AnnotationCreateEllipseMeasurement'
);

const scale2 = new instance.Core.Scale(
  {
    pageScale: { value: 5, unit: 'in' },
    worldScale: { value: 5, unit: 'ft' },
  },
  0.01
);
measurementManager.createAndApplyScale({
  scale: scale2,
  applyTo: [tool],
});

Regards,
Luke

1 Like

Thank you, I found an alternative solution, do you advise against setting scales like so?

const tool = instance.Core.documentViewer.getTool('AnnotationCreateEllipseMeasurement')
tool.setStyles({
   Scale: [['5.0', 'in'],['5.0','ft']],
  Precision: 0.1
})

Thanks

1 Like

Hello Makoa,

You can absolutely use it this way. It is documented in our API that setting scale and precision is valid properties: Apryse WebViewer Class: EllipseMeasurementCreateTool

Regards,
Luke

1 Like

Great, thanks for the confirmation!

1 Like