@realsee/dnalogel 2.0.0-alpha.37 → 2.0.0-alpha.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/ModelViewPlugin/Plugin.d.ts +4 -4
  2. package/dist/ModelViewPlugin/index.js +2 -3
  3. package/dist/PanoRulerProPlugin/Controller.d.ts +15 -0
  4. package/dist/PanoRulerProPlugin/index.d.ts +8 -0
  5. package/dist/PanoRulerProPlugin/index.js +1006 -0
  6. package/dist/PanoRulerProPlugin/typings.d.ts +46 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.es.js +942 -182
  9. package/dist/index.js +942 -181
  10. package/dist/index.umd.js +942 -181
  11. package/dist/shared-utils/logger.d.ts +16 -0
  12. package/docs/assets/search.js +1 -1
  13. package/docs/classes/Magnifier.html +4 -4
  14. package/docs/classes/ModelRoomLabelController.html +4 -4
  15. package/docs/enums/CameraMovementEffect.html +2 -2
  16. package/docs/enums/DIRECTION.html +1 -1
  17. package/docs/enums/DISPLAY_STRATEGY_TYPE.html +1 -1
  18. package/docs/enums/FLOOR_PLAN_ATTACHED_TO.html +1 -1
  19. package/docs/enums/ITEM_LABEL_PLUGIN_DISPLAY_STRATEGY_TYPE.html +1 -1
  20. package/docs/enums/Rotation.html +2 -2
  21. package/docs/index.html +2 -2
  22. package/docs/interfaces/CSS3DRenderPluginExportType.html +2 -2
  23. package/docs/interfaces/CameraMovementPluginExportType.html +2 -2
  24. package/docs/interfaces/FloorplanBounding.html +4 -4
  25. package/docs/interfaces/FloorplanData.html +2 -2
  26. package/docs/interfaces/FloorplanEntrance.html +7 -7
  27. package/docs/interfaces/FloorplanExtraObject.html +3 -3
  28. package/docs/interfaces/FloorplanExtraObject3D.html +2 -2
  29. package/docs/interfaces/FloorplanFloorData.html +2 -2
  30. package/docs/interfaces/FloorplanImagePosition.html +2 -2
  31. package/docs/interfaces/FloorplanObserver.html +2 -2
  32. package/docs/interfaces/FloorplanOutlineItem.html +2 -2
  33. package/docs/interfaces/FloorplanPosition.html +2 -2
  34. package/docs/interfaces/FloorplanRoomItem.html +6 -6
  35. package/docs/interfaces/FloorplanRoomLabelItem.html +3 -3
  36. package/docs/interfaces/FloorplanServerBounding.html +4 -4
  37. package/docs/interfaces/FloorplanServerComputedData.html +1 -1
  38. package/docs/interfaces/FloorplanServerData.html +2 -2
  39. package/docs/interfaces/FloorplanServerEntrance.html +7 -7
  40. package/docs/interfaces/FloorplanServerFloorData.html +2 -2
  41. package/docs/interfaces/FloorplanServerImagePosition.html +2 -2
  42. package/docs/interfaces/FloorplanServerObserver.html +2 -2
  43. package/docs/interfaces/FloorplanServerOutlineItem.html +2 -2
  44. package/docs/interfaces/FloorplanServerPosition.html +2 -2
  45. package/docs/interfaces/FloorplanServerRoomItem.html +7 -7
  46. package/docs/interfaces/FloorplanServerRoomLabelItem.html +3 -3
  47. package/docs/interfaces/ItemLabelPluginData.html +1 -1
  48. package/docs/interfaces/ItemLabelPluginExportReturnsType.html +1 -1
  49. package/docs/interfaces/ItemLabelPluginParametersType.html +1 -1
  50. package/docs/interfaces/LineJson.html +1 -1
  51. package/docs/interfaces/ModelChassisCompassPluginData.html +1 -1
  52. package/docs/interfaces/ModelChassisCompassPluginExportType.html +1 -1
  53. package/docs/interfaces/ModelChassisCompassPluginParameterType.html +1 -1
  54. package/docs/interfaces/ModelEntryDoorGuidePluginData.html +1 -1
  55. package/docs/interfaces/ModelEntryDoorGuidePluginExportType.html +1 -1
  56. package/docs/interfaces/ModelItemLabelPluginData.html +1 -1
  57. package/docs/interfaces/ModelItemLabelPluginExportReturnsType.html +1 -1
  58. package/docs/interfaces/ModelItemLabelPluginParametersType.html +1 -1
  59. package/docs/interfaces/ModelRoomLabelPluginData.html +1 -1
  60. package/docs/interfaces/ModelTVVideoPluginData.html +1 -1
  61. package/docs/interfaces/ModelTVVideoPluginExportType.html +1 -1
  62. package/docs/interfaces/ModelTVVideoPluginParameterType.html +1 -1
  63. package/docs/interfaces/ModelViewPluginExportType.html +1 -1
  64. package/docs/interfaces/OpenParameter.html +2 -2
  65. package/docs/interfaces/PanoCompassPluginData.html +1 -1
  66. package/docs/interfaces/PanoCompassPluginParameterType.html +1 -1
  67. package/docs/interfaces/PanoCursorRaycasterPluginExportType.html +6 -6
  68. package/docs/interfaces/PanoCursorRaycasterPluginParameterType.html +1 -1
  69. package/docs/interfaces/PanoMeasureParameterType.html +1 -1
  70. package/docs/interfaces/PanoRulerPluginExportType.html +1 -1
  71. package/docs/interfaces/PanoRulerPluginOptions.html +1 -1
  72. package/docs/interfaces/PanoRulerPluginParameterType.html +1 -1
  73. package/docs/interfaces/PanoRulerProPluginExportType.html +1 -0
  74. package/docs/interfaces/PanoRulerProPluginOptions.html +1 -0
  75. package/docs/interfaces/PanoRulerProPluginParameterType.html +1 -0
  76. package/docs/interfaces/PanoRulerProPluginState.html +1 -0
  77. package/docs/interfaces/PanoSpatialTagPluginContentEvent.html +1 -1
  78. package/docs/interfaces/PanoSpatialTagPluginContentReplacement.html +1 -1
  79. package/docs/interfaces/PanoSpatialTagPluginData.html +1 -1
  80. package/docs/interfaces/PanoSpatialTagPluginDataElement.html +1 -1
  81. package/docs/interfaces/PanoSpatialTagPluginExportType.html +1 -1
  82. package/docs/interfaces/PanoSpatialTagPluginOriginElement.html +1 -1
  83. package/docs/interfaces/PanoSpatialTagPluginParameterType.html +1 -1
  84. package/docs/interfaces/PanoSpatialTagPluginPointElement.html +1 -1
  85. package/docs/interfaces/PanoSpatialTagPluginTagElement.html +1 -1
  86. package/docs/interfaces/Point.html +1 -1
  87. package/docs/interfaces/PointJson.html +1 -1
  88. package/docs/interfaces/Room.html +1 -1
  89. package/docs/interfaces/RoomInfo.html +1 -1
  90. package/docs/interfaces/RoomLabel.html +7 -7
  91. package/docs/interfaces/RoomRules.html +1 -1
  92. package/docs/interfaces/Rooms.html +1 -1
  93. package/docs/modules.html +19 -17
  94. package/libs/ModelViewPlugin/Plugin.d.ts +4 -4
  95. package/libs/ModelViewPlugin/Plugin.js +2 -3
  96. package/libs/PanoRulerProPlugin/Controller.d.ts +15 -0
  97. package/libs/PanoRulerProPlugin/Controller.js +110 -0
  98. package/libs/PanoRulerProPlugin/RulerItem.js +314 -0
  99. package/libs/PanoRulerProPlugin/RulerItems.js +377 -0
  100. package/libs/PanoRulerProPlugin/index.d.ts +8 -0
  101. package/libs/PanoRulerProPlugin/index.js +8 -0
  102. package/libs/PanoRulerProPlugin/typings.d.ts +46 -0
  103. package/libs/PanoRulerProPlugin/typings.js +1 -0
  104. package/libs/index.d.ts +1 -0
  105. package/libs/index.js +2 -0
  106. package/libs/shared-utils/logger.d.ts +16 -0
  107. package/libs/shared-utils/logger.js +47 -0
  108. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import type { FivePlugin } from '@realsee/five';
2
2
  export interface ModelViewPluginExportType {
3
- appendTo(element: HTMLElement, size?: {
3
+ appendTo: (element: HTMLElement, size?: {
4
4
  width?: number;
5
5
  height?: number;
6
- }): void;
7
- refresh(size?: {
6
+ }) => void;
7
+ refresh: (size?: {
8
8
  width?: number;
9
9
  height?: number;
10
- }): void;
10
+ }) => void;
11
11
  }
12
12
  /**
13
13
  * Five 模型插件
@@ -49,8 +49,7 @@ export const ModelViewPlugin = (five) => {
49
49
  };
50
50
  const handleModelLoaded = () => {
51
51
  function cloneMaterial(material) {
52
- material = material.clone();
53
- material.uniforms.modelAlpha.value = 1;
52
+ material.clone().uniforms.modelAlpha.value = 1;
54
53
  if (material.uniforms.map.value) {
55
54
  material.uniforms.map.value.needsUpdate = true;
56
55
  }
@@ -98,7 +97,7 @@ export const ModelViewPlugin = (five) => {
98
97
  return;
99
98
  const element = renderer.domElement;
100
99
  const container = element.parentNode;
101
- if (container && container.nodeName) {
100
+ if (container === null || container === void 0 ? void 0 : container.nodeName) {
102
101
  const { width = container.offsetWidth, height = container.offsetHeight } = size;
103
102
  renderer.setSize(width, height);
104
103
  // 修改摄像机 aspect 比值
@@ -0,0 +1,15 @@
1
+ import type { Five } from '@realsee/five';
2
+ import type { PanoRulerProPluginDatas, PanoRulerProPluginParameterType, PanoRulerProPluginState } from './typings';
3
+ export default class Controller {
4
+ private five;
5
+ private container;
6
+ private panoRulerProData;
7
+ private rulerItems;
8
+ state: PanoRulerProPluginState;
9
+ constructor(five: Five, params: PanoRulerProPluginParameterType);
10
+ load(serverData: PanoRulerProPluginDatas): Promise<void>;
11
+ enable(): boolean;
12
+ disable(): boolean;
13
+ private render;
14
+ private dispose;
15
+ }
@@ -0,0 +1,110 @@
1
+ import RulerItems from './RulerItems';
2
+ export default class Controller {
3
+ constructor(five, params) {
4
+ var _a, _b;
5
+ Object.defineProperty(this, "five", {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value: void 0
10
+ });
11
+ Object.defineProperty(this, "container", {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value: document.createElement('div')
16
+ });
17
+ Object.defineProperty(this, "panoRulerProData", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ Object.defineProperty(this, "rulerItems", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: void 0
28
+ });
29
+ Object.defineProperty(this, "state", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: {
34
+ enabled: false,
35
+ loaded: false,
36
+ options: {
37
+ className: '',
38
+ distanceText: (distance) => `${distance.toFixed(1)}m`,
39
+ },
40
+ }
41
+ });
42
+ this.five = five;
43
+ this.container.classList.add('panoRulerProPlugin-container');
44
+ this.container.setAttribute('style', `position: absolute;pointer-events: none;width: 100%;height: 100%;left: 0;top: 0;overflow: hidden;`);
45
+ if (params) {
46
+ if (params.data) {
47
+ this.load(params.data);
48
+ }
49
+ this.state.options = Object.assign(Object.assign({}, this.state.options), (params.options || {}));
50
+ if ((_a = params.options) === null || _a === void 0 ? void 0 : _a.className)
51
+ this.container.classList.add((_b = params.options) === null || _b === void 0 ? void 0 : _b.className);
52
+ }
53
+ this.five.once('modelLoaded', async () => {
54
+ var _a, _b;
55
+ (_b = (_a = this.five.getElement()) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.append(this.container);
56
+ });
57
+ this.five.once('dispose', () => this.dispose());
58
+ }
59
+ async load(serverData) {
60
+ if (!this.five.work)
61
+ return;
62
+ const data = serverData.data;
63
+ if (!data)
64
+ throw new Error('标尺数据依赖不齐全!');
65
+ this.panoRulerProData = data;
66
+ this.state.loaded = true;
67
+ }
68
+ enable() {
69
+ if (!this.state.loaded)
70
+ return false;
71
+ if (this.state.enabled)
72
+ return true;
73
+ this.state.enabled = true;
74
+ this.render();
75
+ return true;
76
+ }
77
+ disable() {
78
+ if (!this.state.enabled)
79
+ return true;
80
+ this.state.enabled = false;
81
+ this.render();
82
+ return true;
83
+ }
84
+ async render() {
85
+ var _a;
86
+ if (this.state.enabled) {
87
+ if (!this.panoRulerProData || !this.container)
88
+ return;
89
+ this.rulerItems = new RulerItems({
90
+ target: this.container,
91
+ props: {
92
+ five: this.five,
93
+ rulerDatas: this.panoRulerProData,
94
+ options: this.state.options,
95
+ },
96
+ });
97
+ }
98
+ else {
99
+ (_a = this.rulerItems) === null || _a === void 0 ? void 0 : _a.$destroy();
100
+ this.rulerItems = undefined;
101
+ }
102
+ }
103
+ dispose() {
104
+ if (this.container) {
105
+ this.rulerItems.$destroy();
106
+ this.rulerItems = undefined;
107
+ }
108
+ this.container.remove();
109
+ }
110
+ }
@@ -0,0 +1,314 @@
1
+ /* generated by Svelte v3.47.0 */
2
+ import {
3
+ SvelteComponent,
4
+ add_render_callback,
5
+ add_resize_listener,
6
+ append,
7
+ append_styles,
8
+ attr,
9
+ destroy_each,
10
+ detach,
11
+ element,
12
+ init,
13
+ insert,
14
+ noop,
15
+ null_to_empty,
16
+ safe_not_equal,
17
+ set_data,
18
+ set_style,
19
+ space,
20
+ text
21
+ } from "svelte/internal";
22
+
23
+ function add_css(target) {
24
+ append_styles(target, "svelte-xuljmc", ".PanoRulerPlugin-rule-line.svelte-xuljmc.svelte-xuljmc{position:absolute;transform-origin:left 0.0625rem;width:0;height:0.125rem;pointer-events:none}.PanoRulerPlugin-rule-line.svelte-xuljmc.svelte-xuljmc::after{content:'';position:absolute;left:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-xuljmc-viewport-rule-point 0.1s 1s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-xuljmc.svelte-xuljmc::before{content:'';position:absolute;right:-0.125rem;top:-0.1rem;width:0.25rem;height:0.25rem;border-radius:50%;background:#fff;z-index:1;animation:svelte-xuljmc-viewport-rule-point 0.1s 1.5s;animation-fill-mode:both}.PanoRulerPlugin-rule-line.svelte-xuljmc em.svelte-xuljmc{display:block;height:0.0625rem;animation:svelte-xuljmc-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;box-shadow:0 0 0.25rem rgb(0 0 0 / 40%);position:relative}.rule-mixed-line.svelte-xuljmc.svelte-xuljmc{display:flex;height:0.0625rem;animation:svelte-xuljmc-viewport-rule-line 0.5s ease 1s;animation-fill-mode:both;align-items:center}.em-solid.svelte-xuljmc.svelte-xuljmc{height:100%;background:#ffffff}.em-dotted.svelte-xuljmc.svelte-xuljmc{height:0.125rem;background:var(--background-image);background-position:center;background-repeat:repeat}.PanoRulerPlugin-rule-label.svelte-xuljmc.svelte-xuljmc{position:absolute;width:0;height:0;top:0.0625rem;pointer-events:none}.PanoRulerPlugin-rule-label-name.svelte-xuljmc.svelte-xuljmc{position:absolute;padding:0.1875rem 0.375rem;background:rgba(195, 195, 195, 0.3);backdrop-filter:blur(0.25rem);-webkit-backdrop-filter:blur(0.25rem);border-radius:6.25rem;border:0.0625rem solid rgba(255, 255, 255, 0.6);white-space:nowrap;overflow:hidden;color:#ffffff;font-weight:500;font-size:0.75rem;line-height:1;-webkit-animation:svelte-xuljmc-viewport-rule-label 0.25s ease 1s;animation:svelte-xuljmc-viewport-rule-label 0.25s ease 1s;animation-fill-mode:both;box-shadow:inset 0 0 0.625rem 0 rgba(255, 255, 255, 0.3)}@keyframes svelte-xuljmc-viewport-rule-line{0%{width:0%}100%{width:100%}}@keyframes svelte-xuljmc-viewport-rule-label{0%{opacity:0;transform:scaleX(0)}100%{opacity:1;transform:translate(-50%, -50%) scaleX(1)}}@keyframes svelte-xuljmc-viewport-rule-point{0%{transform:scaleX(0)}100%{transform:scaleX(1)}}");
25
+ }
26
+
27
+ function get_each_context(ctx, list, i) {
28
+ const child_ctx = ctx.slice();
29
+ child_ctx[6] = list[i];
30
+ return child_ctx;
31
+ }
32
+
33
+ // (28:2) {:else}
34
+ function create_else_block(ctx) {
35
+ let div;
36
+ let each_value = /*rulerItemProp*/ ctx[0].children;
37
+ let each_blocks = [];
38
+
39
+ for (let i = 0; i < each_value.length; i += 1) {
40
+ each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
41
+ }
42
+
43
+ return {
44
+ c() {
45
+ div = element("div");
46
+
47
+ for (let i = 0; i < each_blocks.length; i += 1) {
48
+ each_blocks[i].c();
49
+ }
50
+
51
+ attr(div, "class", "rule-mixed-line svelte-xuljmc");
52
+ },
53
+ m(target, anchor) {
54
+ insert(target, div, anchor);
55
+
56
+ for (let i = 0; i < each_blocks.length; i += 1) {
57
+ each_blocks[i].m(div, null);
58
+ }
59
+ },
60
+ p(ctx, dirty) {
61
+ if (dirty & /*rulerItemProp, vars*/ 9) {
62
+ each_value = /*rulerItemProp*/ ctx[0].children;
63
+ let i;
64
+
65
+ for (i = 0; i < each_value.length; i += 1) {
66
+ const child_ctx = get_each_context(ctx, each_value, i);
67
+
68
+ if (each_blocks[i]) {
69
+ each_blocks[i].p(child_ctx, dirty);
70
+ } else {
71
+ each_blocks[i] = create_each_block(child_ctx);
72
+ each_blocks[i].c();
73
+ each_blocks[i].m(div, null);
74
+ }
75
+ }
76
+
77
+ for (; i < each_blocks.length; i += 1) {
78
+ each_blocks[i].d(1);
79
+ }
80
+
81
+ each_blocks.length = each_value.length;
82
+ }
83
+ },
84
+ d(detaching) {
85
+ if (detaching) detach(div);
86
+ destroy_each(each_blocks, detaching);
87
+ }
88
+ };
89
+ }
90
+
91
+ // (26:2) {#if rulerItemProp.children.length === 0}
92
+ function create_if_block(ctx) {
93
+ let em;
94
+ let em_class_value;
95
+
96
+ return {
97
+ c() {
98
+ em = element("em");
99
+
100
+ attr(em, "class", em_class_value = "" + (null_to_empty(/*rulerItemProp*/ ctx[0].state
101
+ ? 'em-solid'
102
+ : 'em-dotted') + " svelte-xuljmc"));
103
+
104
+ attr(em, "style", /*vars*/ ctx[3]);
105
+ },
106
+ m(target, anchor) {
107
+ insert(target, em, anchor);
108
+ },
109
+ p(ctx, dirty) {
110
+ if (dirty & /*rulerItemProp*/ 1 && em_class_value !== (em_class_value = "" + (null_to_empty(/*rulerItemProp*/ ctx[0].state
111
+ ? 'em-solid'
112
+ : 'em-dotted') + " svelte-xuljmc"))) {
113
+ attr(em, "class", em_class_value);
114
+ }
115
+
116
+ if (dirty & /*vars*/ 8) {
117
+ attr(em, "style", /*vars*/ ctx[3]);
118
+ }
119
+ },
120
+ d(detaching) {
121
+ if (detaching) detach(em);
122
+ }
123
+ };
124
+ }
125
+
126
+ // (30:6) {#each rulerItemProp.children as child}
127
+ function create_each_block(ctx) {
128
+ let div;
129
+ let div_class_value;
130
+ let style_width = `${/*child*/ ctx[6].width}px`;
131
+
132
+ return {
133
+ c() {
134
+ div = element("div");
135
+ attr(div, "class", div_class_value = "" + (null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-xuljmc"));
136
+ attr(div, "style", /*vars*/ ctx[3]);
137
+ set_style(div, "width", style_width, false);
138
+ },
139
+ m(target, anchor) {
140
+ insert(target, div, anchor);
141
+ },
142
+ p(ctx, dirty) {
143
+ if (dirty & /*rulerItemProp*/ 1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*child*/ ctx[6].state ? 'em-solid' : 'em-dotted') + " svelte-xuljmc"))) {
144
+ attr(div, "class", div_class_value);
145
+ }
146
+
147
+ if (dirty & /*vars*/ 8) {
148
+ attr(div, "style", /*vars*/ ctx[3]);
149
+ }
150
+
151
+ if (dirty & /*rulerItemProp*/ 1 && style_width !== (style_width = `${/*child*/ ctx[6].width}px`)) {
152
+ set_style(div, "width", style_width, false);
153
+ }
154
+ },
155
+ d(detaching) {
156
+ if (detaching) detach(div);
157
+ }
158
+ };
159
+ }
160
+
161
+ function create_fragment(ctx) {
162
+ let div2;
163
+ let t0;
164
+ let div1;
165
+ let div0;
166
+ let t1_value = /*rulerItemProp*/ ctx[0].labelElement + "";
167
+ let t1;
168
+ let div0_resize_listener;
169
+ let style_left = `${/*rulerItemProp*/ ctx[0].labelOffset}%`;
170
+ let style_width = `${/*rulerItemProp*/ ctx[0].width}px`;
171
+ let style_left_1 = `${/*rulerItemProp*/ ctx[0].left}px`;
172
+ let style_top = `${/*rulerItemProp*/ ctx[0].top}px`;
173
+ let style_transform = `rotate(${/*rulerItemProp*/ ctx[0].rotateDeg}deg)`;
174
+
175
+ function select_block_type(ctx, dirty) {
176
+ if (/*rulerItemProp*/ ctx[0].children.length === 0) return create_if_block;
177
+ return create_else_block;
178
+ }
179
+
180
+ let current_block_type = select_block_type(ctx, -1);
181
+ let if_block = current_block_type(ctx);
182
+
183
+ return {
184
+ c() {
185
+ div2 = element("div");
186
+ if_block.c();
187
+ t0 = space();
188
+ div1 = element("div");
189
+ div0 = element("div");
190
+ t1 = text(t1_value);
191
+ attr(div0, "class", "PanoRulerPlugin-rule-label-name svelte-xuljmc");
192
+ add_render_callback(() => /*div0_elementresize_handler*/ ctx[4].call(div0));
193
+ attr(div1, "class", "PanoRulerPlugin-rule-label svelte-xuljmc");
194
+ set_style(div1, "left", style_left, false);
195
+ attr(div2, "class", "PanoRulerPlugin-rule-line svelte-xuljmc");
196
+ set_style(div2, "width", style_width, false);
197
+ set_style(div2, "left", style_left_1, false);
198
+ set_style(div2, "top", style_top, false);
199
+ set_style(div2, "transform", style_transform, false);
200
+
201
+ set_style(
202
+ div2,
203
+ "display",
204
+ /*rulerItemProp*/ ctx[0].visible && /*_visible*/ ctx[2]
205
+ ? 'block'
206
+ : 'none',
207
+ false
208
+ );
209
+ },
210
+ m(target, anchor) {
211
+ insert(target, div2, anchor);
212
+ if_block.m(div2, null);
213
+ append(div2, t0);
214
+ append(div2, div1);
215
+ append(div1, div0);
216
+ append(div0, t1);
217
+ div0_resize_listener = add_resize_listener(div0, /*div0_elementresize_handler*/ ctx[4].bind(div0));
218
+ },
219
+ p(ctx, [dirty]) {
220
+ if (current_block_type === (current_block_type = select_block_type(ctx, dirty)) && if_block) {
221
+ if_block.p(ctx, dirty);
222
+ } else {
223
+ if_block.d(1);
224
+ if_block = current_block_type(ctx);
225
+
226
+ if (if_block) {
227
+ if_block.c();
228
+ if_block.m(div2, t0);
229
+ }
230
+ }
231
+
232
+ if (dirty & /*rulerItemProp*/ 1 && t1_value !== (t1_value = /*rulerItemProp*/ ctx[0].labelElement + "")) set_data(t1, t1_value);
233
+
234
+ if (dirty & /*rulerItemProp*/ 1 && style_left !== (style_left = `${/*rulerItemProp*/ ctx[0].labelOffset}%`)) {
235
+ set_style(div1, "left", style_left, false);
236
+ }
237
+
238
+ if (dirty & /*rulerItemProp*/ 1 && style_width !== (style_width = `${/*rulerItemProp*/ ctx[0].width}px`)) {
239
+ set_style(div2, "width", style_width, false);
240
+ }
241
+
242
+ if (dirty & /*rulerItemProp*/ 1 && style_left_1 !== (style_left_1 = `${/*rulerItemProp*/ ctx[0].left}px`)) {
243
+ set_style(div2, "left", style_left_1, false);
244
+ }
245
+
246
+ if (dirty & /*rulerItemProp*/ 1 && style_top !== (style_top = `${/*rulerItemProp*/ ctx[0].top}px`)) {
247
+ set_style(div2, "top", style_top, false);
248
+ }
249
+
250
+ if (dirty & /*rulerItemProp*/ 1 && style_transform !== (style_transform = `rotate(${/*rulerItemProp*/ ctx[0].rotateDeg}deg)`)) {
251
+ set_style(div2, "transform", style_transform, false);
252
+ }
253
+
254
+ if (dirty & /*rulerItemProp, _visible*/ 5) {
255
+ set_style(
256
+ div2,
257
+ "display",
258
+ /*rulerItemProp*/ ctx[0].visible && /*_visible*/ ctx[2]
259
+ ? 'block'
260
+ : 'none',
261
+ false
262
+ );
263
+ }
264
+ },
265
+ i: noop,
266
+ o: noop,
267
+ d(detaching) {
268
+ if (detaching) detach(div2);
269
+ if_block.d();
270
+ div0_resize_listener();
271
+ }
272
+ };
273
+ }
274
+
275
+ function instance($$self, $$props, $$invalidate) {
276
+ let vars;
277
+ let { rulerItemProp } = $$props;
278
+ let _visible = true;
279
+ let labelWidth;
280
+ let EM_DOTTED_BG = `data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PGZpbHRlciBpZD0icHJlZml4X19hIiBoZWlnaHQ9IjQwMCUiIHdpZHRoPSIxMzcuNCUiIHg9Ii0xOC43JSIgeT0iLTE1MCUiPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiBvcGVyYXRvcj0iZGlsYXRlIiByYWRpdXM9Ii41IiByZXN1bHQ9InNoYWRvd1NwcmVhZE91dGVyMSIvPjxmZU9mZnNldCBpbj0ic2hhZG93U3ByZWFkT3V0ZXIxIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZU1vcnBob2xvZ3kgaW49IlNvdXJjZUFscGhhIiByYWRpdXM9IjEiIHJlc3VsdD0ic2hhZG93SW5uZXIiLz48ZmVPZmZzZXQgaW49InNoYWRvd0lubmVyIiByZXN1bHQ9InNoYWRvd0lubmVyIi8+PGZlQ29tcG9zaXRlIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIGluMj0ic2hhZG93SW5uZXIiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93T2Zmc2V0T3V0ZXIxIi8+PGZlR2F1c3NpYW5CbHVyIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIgc3RkRGV2aWF0aW9uPSIuNSIvPjxmZUNvbG9yTWF0cml4IGluPSJzaGFkb3dCbHVyT3V0ZXIxIiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMiAwIi8+PC9maWx0ZXI+PHBhdGggaWQ9InByZWZpeF9fYiIgZD0iTS44ODkgMkgxMS41OCIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1kYXNoYXJyYXk9IjUgNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48dXNlIGZpbGw9IiMwMDAiIGZpbHRlcj0idXJsKCNwcmVmaXhfX2EpIiB4bGluazpocmVmPSIjcHJlZml4X19iIi8+PHVzZSBzdHJva2U9IiNmZmYiIHN0cm9rZS1vcGFjaXR5PSIuNCIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjwvZz48L3N2Zz4=`;
281
+
282
+ function div0_elementresize_handler() {
283
+ labelWidth = this.offsetWidth;
284
+ $$invalidate(1, labelWidth);
285
+ }
286
+
287
+ $$self.$$set = $$props => {
288
+ if ('rulerItemProp' in $$props) $$invalidate(0, rulerItemProp = $$props.rulerItemProp);
289
+ };
290
+
291
+ $$self.$$.update = () => {
292
+ if ($$self.$$.dirty & /*labelWidth, rulerItemProp*/ 3) {
293
+ $: {
294
+ if (labelWidth >= rulerItemProp.width || labelWidth / 2 >= rulerItemProp.labelOffset / 100 * rulerItemProp.width || labelWidth / 2 >= (1 - rulerItemProp.labelOffset / 100) * rulerItemProp.width) {
295
+ $$invalidate(2, _visible = false);
296
+ } else {
297
+ $$invalidate(2, _visible = true);
298
+ }
299
+ }
300
+ }
301
+ };
302
+
303
+ $: $$invalidate(3, vars = `--background-image: url(${EM_DOTTED_BG})`);
304
+ return [rulerItemProp, labelWidth, _visible, vars, div0_elementresize_handler];
305
+ }
306
+
307
+ class Component extends SvelteComponent {
308
+ constructor(options) {
309
+ super();
310
+ init(this, options, instance, create_fragment, safe_not_equal, { rulerItemProp: 0 }, add_css);
311
+ }
312
+ }
313
+
314
+ export default Component;