|
115 | 115 | currentObject.fillColor = 'black'; |
116 | 116 | currentObject.strokeWidth = 2; |
117 | 117 | break; |
| 118 | + case 'text-highlight': |
| 119 | + textRowMouseDown = findRowUnderPoint($rootScope.docInfo, attrs.number, event.point); |
| 120 | + currentObject = new ps.Path.Rectangle(new ps.Rectangle( |
| 121 | + event.point.x, |
| 122 | + textRowMouseDown.lineTop, |
| 123 | + 1, |
| 124 | + textRowMouseDown.lineHeight) |
| 125 | + ); |
| 126 | + currentObject.fillColor = 'yellow'; |
| 127 | + currentObject.opacity = 0.3; |
| 128 | + break; |
118 | 129 | case 'underline': |
119 | 130 | case 'strikeout': |
120 | 131 | textRowMouseDown = findRowUnderPoint($rootScope.docInfo, attrs.number, event.point); |
|
154 | 165 | currentObject.position.x += event.delta.x; |
155 | 166 | currentObject.position.y += event.delta.y; |
156 | 167 | break; |
| 168 | + case 'text-highlight': |
157 | 169 | case 'underline': |
158 | 170 | case 'strikeout': |
159 | 171 | if (currentObject !== null) { |
|
246 | 258 | width: currentObject.bounds.width, |
247 | 259 | height: currentObject.bounds.height |
248 | 260 | }, |
| 261 | + penColor: 0x010101, |
| 262 | + penStyle: 1, |
| 263 | + penWidth: 2, |
249 | 264 | type: 1 |
250 | 265 | }; |
251 | 266 | break; |
252 | 267 | case 'pencil': |
253 | | - ant.type = 4; |
254 | | - ant.svgPath = extractSvgPathData(currentObject); |
| 268 | + ant = angular.merge({}, ant, { |
| 269 | + penColor: 0x010101, |
| 270 | + penStyle: 1, |
| 271 | + penWidth: 2, |
| 272 | + svgPath: extractSvgPathData(currentObject), |
| 273 | + type: 4 |
| 274 | + }); |
255 | 275 | break; |
256 | 276 | case 'point': |
257 | 277 | ant = angular.merge({}, ant, { |
| 278 | + penColor: 0x010101, |
| 279 | + penStyle: 1, |
| 280 | + penWidth: 2, |
258 | 281 | type: 2, |
259 | 282 | box: { |
260 | 283 | x: event.point.x, |
|
265 | 288 | }); |
266 | 289 | break; |
267 | 290 | case 'arrow': |
268 | | - ant.type = 8; |
269 | | - ant.svgPath = extractSvgPathData(currentObject); |
| 291 | + ant = angular.merge({}, ant, { |
| 292 | + penColor: 0x010101, |
| 293 | + penStyle: 1, |
| 294 | + penWidth: 2, |
| 295 | + svgPath: extractSvgPathData(currentObject), |
| 296 | + type: 8 |
| 297 | + }); |
270 | 298 | break; |
271 | 299 | case 'distance': |
272 | 300 | ant = { |
| 301 | + penColor: 0x010101, |
| 302 | + penStyle: 1, |
| 303 | + penWidth: 2, |
273 | 304 | type: 12, |
274 | 305 | svgPath: extractSvgPathData(currentObject), |
275 | 306 | fieldText: currentObject.children[3].content, |
|
281 | 312 | } |
282 | 313 | }; |
283 | 314 | break; |
| 315 | + case 'text-highlight': |
284 | 316 | case 'underline': |
285 | 317 | case 'strikeout': |
286 | 318 | if (currentObject !== null) { |
|
316 | 348 | }); |
317 | 349 | currentObject.remove(); |
318 | 350 | switch ($rootScope.selectedDrawingTool) { |
| 351 | + case 'text-highlight': |
| 352 | + currentObject = new ps.Path.Rectangle(new ps.Rectangle( |
| 353 | + currentObject.bounds.x, |
| 354 | + currentObject.bounds.y, |
| 355 | + currentObject.bounds.width, |
| 356 | + currentObject.bounds.height |
| 357 | + )); |
| 358 | + currentObject.fillColor = 'yellow'; |
| 359 | + currentObject.opacity = 0.3; |
| 360 | + ant = angular.merge({}, ant, { |
| 361 | + penColor: 0xffff01, |
| 362 | + penStyle: 1, |
| 363 | + penWidth: 2, |
| 364 | + type: 0 |
| 365 | + }); |
| 366 | + break; |
319 | 367 | case 'underline': |
320 | 368 | currentObject = new ps.Path.Line({ |
321 | 369 | from: [ |
|
328 | 376 | ], |
329 | 377 | strokeColor: 'black' |
330 | 378 | }); |
331 | | - ant = angular.merge({}, ant, {type: 11}); |
| 379 | + ant = angular.merge({}, ant, { |
| 380 | + penColor: 0x010101, |
| 381 | + penStyle: 1, |
| 382 | + penWidth: 2, |
| 383 | + type: 11 |
| 384 | + }); |
332 | 385 | break; |
333 | 386 | case 'strikeout': |
334 | 387 | currentObject = new ps.Path.Line({ |
|
342 | 395 | ], |
343 | 396 | strokeColor: 'black' |
344 | 397 | }); |
345 | | - ant = angular.merge({}, ant, {type: 3}); |
| 398 | + ant = angular.merge({}, ant, { |
| 399 | + penColor: 0x010101, |
| 400 | + penStyle: 1, |
| 401 | + penWidth: 2, |
| 402 | + type: 3 |
| 403 | + }); |
346 | 404 | break; |
347 | 405 | } |
348 | 406 | } |
349 | 407 | break; |
350 | 408 | } |
351 | 409 |
|
352 | | - if (ant.type) { |
| 410 | + if (typeof(ant.type) !== 'undefined') { |
353 | 411 | ant = angular.merge({}, ant, { |
354 | | - penColor: 0x010101, |
355 | | - penStyle: 1, |
356 | | - penWidth: 2, |
357 | 412 | pageNumber: attrs.number |
358 | 413 | }); |
359 | 414 | var a = new AnnotationAddFactory(ant); |
|
373 | 428 |
|
374 | 429 | ps.tool.onMouseMove = function (event) { |
375 | 430 | switch ($rootScope.selectedDrawingTool) { |
| 431 | + case 'text-highlight': |
376 | 432 | case 'underline': |
377 | 433 | case 'strikeout': |
378 | 434 | var r = findRowUnderPoint($rootScope.docInfo, attrs.number, event.point); |
|
504 | 560 | distance.children[3].strokeWidth = 0.5; |
505 | 561 | distance.name = item.annotation.guid; |
506 | 562 | break; |
| 563 | + case 0: |
| 564 | + var shape = new ps.Rectangle( |
| 565 | + item.annotation.box.x, |
| 566 | + attrs.height - item.annotation.box.y, |
| 567 | + item.annotation.box.width, |
| 568 | + item.annotation.box.height |
| 569 | + ); |
| 570 | + var path = new ps.Path.Rectangle(shape); |
| 571 | + path.fillColor = 'yellow'; |
| 572 | + path.opacity = 0.3; |
| 573 | + path.name = item.annotation.guid; |
| 574 | + break; |
507 | 575 | } |
508 | 576 | }) |
509 | 577 | } |
|
0 commit comments