UNPKG

@nativescript-community/ui-carto

Version:

NativeScript plugin for CARTO Mobile SDK

67 lines 2.24 kB
import { geometryFromArgs, nativeColorProperty, nativeProperty } from '..'; import { BaseVectorElementStyleBuilder, styleBuilderProperty } from './index.common'; import { BasePointVectorElement } from './index.ios'; export class PointStyleBuilder extends BaseVectorElementStyleBuilder { createNative(options) { return NTPointStyleBuilder.alloc().init(); } buildStyle() { if (!this.mBuildStyle) { this.mBuildStyle = this.getNative().buildStyle(); } return this.mBuildStyle; } } __decorate([ nativeProperty ], PointStyleBuilder.prototype, "size", void 0); __decorate([ nativeColorProperty ], PointStyleBuilder.prototype, "color", void 0); __decorate([ nativeProperty ], PointStyleBuilder.prototype, "clickSize", void 0); export class Point extends BasePointVectorElement { createNative(options) { const style = this.buildStyle(); const nativePos = this.getNativePos(options.position, options.projection); const result = NTPoint.alloc().initWithPosStyle(nativePos, style); // result['owner'] = new WeakRef(this); return result; } buildStyle() { let style; const styleBuilder = this.options.styleBuilder; if (styleBuilder instanceof NTPointStyle) { style = styleBuilder; } else if (styleBuilder instanceof PointStyleBuilder) { style = styleBuilder.buildStyle(); } else if (styleBuilder.hasOwnProperty) { style = new PointStyleBuilder(styleBuilder).buildStyle(); } return style; } get styleBuilder() { return this.native ? this.native.getStyle() : this.options.styleBuilder; } set styleBuilder(value) { if (this.native && !this.duringInit) { this.options.styleBuilder = value; this.native.setStyle(this.buildStyle()); } } set geometry(geometry) { if (this.native) { this.native.setGeometry(geometryFromArgs(geometry)); } } } __decorate([ styleBuilderProperty ], Point.prototype, "color", void 0); __decorate([ styleBuilderProperty ], Point.prototype, "size", void 0); //# sourceMappingURL=point.ios.js.map