Select to view content in your preferred language

4.7 Difference between drawing polygon and circle/rectangle with sketchViewModel

786
2
04-30-2018 09:36 AM
TubaKumbara
Regular Contributor

Hello.

I can draw polygon with below code

scketchViewModel.create("polygon");

I want to draw rectangle and circle with cketchViewModel tried below codes but it seems doesn't working

scketchViewModel.create("rectangle");

scketchViewModel.create("circle");

What i'm doing wrong. Is there a sample code if rectangle and circle drawing is totally different from polygon.

Thanks inadvance.

0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor

Can you post more of your code? The SketchViewModel sample shows that syntax for creating rectangles and circles working correctly.

// ***************************************
// activate the sketch to create a rectangle
// ***************************************
var drawRectangleButton = document.getElementById("rectangleButton");
drawRectangleButton.onclick = function() {
  // set the sketch to create a polygon geometry
  sketchViewModel.create("rectangle");
  setActiveButton(this);
};

// ***************************************
// activate the sketch to create a circle
// ***************************************
var drawCircleButton = document.getElementById("circleButton");
drawCircleButton.onclick = function() {
  // set the sketch to create a polygon geometry
  sketchViewModel.create("circle");
  setActiveButton(this);
};
TubaKumbara
Regular Contributor

Hello Ken. thanks for reply,

I found my code was wrong. I missed a "#" when i getting button id with jquery.

my problem solved now.

Best regards.

0 Kudos